Returns an iterator to the first element of the cartesian_product_view
.
Let bases_
be the tuple of underlying views.
return /*iterator*/<false>(__tuple_transform(ranges::begin, bases_));
.return /*iterator*/<true>(__tuple_transform(ranges::begin, bases_));
.(none).
Iterator to the first element.
Can be checked online with Compiler Explorer.
#include <array> #include <print> #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::println("{}{}{}{}", std::get<0>(first), std::get<1>(first), std::get<2>(first), std::get<3>(first)); }
Output:
(C++23) | returns an iterator or a sentinel to the end (public member function) |
(C++20) | returns an iterator to the beginning of a range (customization point object) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/ranges/cartesian_product_view/begin