On this page
std::ranges::cartesian_product_view<First, Vs...>::iterator<Const>::next, std::ranges::cartesian_product_view<First, Vs...>::iterator<Const>::prev, std::ranges::cartesian_product_view<First, Vs...>::iterator<Const>::distance_from
std::ranges::cartesian_product_view::iterator::next
|
(since C++23) (exposition only*) |
If called with default template parameter, recursively generates the next element (the tuple of iterators) in cartesian_product_view.
Let current_ denote the underlying tuple of iterators. Equivalent to:
auto& it = std::get<N>(current_);
++it;
if constexpr (N > 0)
{
if (it == ranges::end(std::get<N>(parent_->bases_)))
{
it = ranges::begin(std::get<N>(parent_->bases_));
next<N - 1>();
}
}
Used in the following non-static member functions:
- ranges::cartesian_product_view::
operator+
std::ranges::cartesian_product_view::iterator::prev
|
(since C++23) (exposition only*) |
If called with default template parameter, recursively generates the previous element (the tuple of iterators) in cartesian_product_view.
Let current_ denote the underlying tuple of iterators. Equivalent to:
auto& it = std::get<N>(current_);
if constexpr (N > 0)
{
if (it == ranges::begin(std::get<N>(parent_->bases_)))
{
it = /*cartesian-common-arg-end*/(std::get<N>(parent_->bases_));
prev<N - 1>();
}
}
--it;
Used in the following non-static member functions:
- ranges::cartesian_product_view::
operator-
std::ranges::cartesian_product_view::iterator::distance_from
|
(since C++23) (exposition only*) |
Returns the "distance" (i.e., number of "hops") between two iterators.
Let:
parent_be the underlying pointer tocartesian_product_view/*scaled-size*/(N)be:- the product of
static_cast<difference_type>(ranges::size(std::get<N>(parent_->bases_)))and/*scaled-size*/(N + 1)ifN ≤ sizeof...(Vs), otherwise static_cast<difference_type>(1);
- the product of
/*scaled-distance*/(N)be the product ofstatic_cast<difference_type>(std::get<N>(current_) - std::get<N>(t))and/*scaled-size*/(N + 1);/*scaled-sum*/be the sum of/*scaled-distance*/(N)for every integer0 ≤ N ≤ sizeof...(Vs).
Returns: /*scaled-sum*/.
The behavior is undefined if /*scaled-sum*/ cannot be represented by difference_type.
Used in the following functions:
operator-(const /*iterator*/&, const /*iterator*/&)operator-(const /*iterator*/&, std::default_sentinel_t)
Parameters
| t | - | a tuple of iterators to find the distance to |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/ranges/cartesian_product_view/iterator/helpers