table of contents
        
      
      
    - Tumbleweed 2024.07.05-1.3
 - Leap-16.0
 
| std::ranges::cartesian_product_view::begin(3) | C++ Standard Libary | std::ranges::cartesian_product_view::begin(3) | 
NAME¶
std::ranges::cartesian_product_view::begin - std::ranges::cartesian_product_view::begin
Synopsis¶
 constexpr iterator<false> begin() (1) (since C++23)
  
   requires (!__simple_view<First> || ... || !__simple_view<Vs>);
  
   constexpr iterator<true> begin() const
  
   requires (ranges::range<const First> && ... &&
    (2) (since C++23)
  
   ranges::range<const Vs>);
  
   Returns an iterator to the first element of the cartesian_product_view.
  
   Let bases_ be the tuple of underlying views.
  
   1) Equivalent to return
    /*iterator*/<false>(__tuple_transform(ranges::begin,
  
   bases_));.
  
   2) Equivalent to return
    /*iterator*/<true>(__tuple_transform(ranges::begin,
  
   bases_));.
Parameters¶
(none)
Return value¶
An iterator to the first element.
Example¶
// Run this code
  
   #include <array>
  
   #include <format>
  
   #include <iostream>
  
   #include <ranges>
  
   #include <string_view>
  
   #include <tuple>
  
   using namespace std::literals;
  
   int main()
  
   {
  
   constexpr auto a = std::array{"Curiously"sv,
    "Recurring"sv, "Template"sv, "Pattern"sv};
  
   constexpr auto v = std::ranges::cartesian_product_view(a[0], a[1], a[2],
    a[3]);
  
   constexpr std::tuple<char const&,
  
   char const&,
  
   char const&,
  
   char const&> first{*v.begin()};
  
   std::cout << std::format("{}{}{}{}{}",
  
   std::get<0>(first),
  
   std::get<1>(first),
  
   std::get<2>(first),
  
   std::get<3>(first),
  
   '\n');
  
   }
Output:¶
CRTP
See also¶
 end returns an iterator or a sentinel to the end
  
   (C++23) (public member function)
  
   ranges::begin returns an iterator to the beginning of a range
  
   (C++20) (customization point object)
| 2024.06.10 | http://cppreference.com |