std::ranges::cartesian_product_view<First, Vs...>::iterator<Const>::operator++,--,+=,-=
来自cppreference.com
< cpp | ranges | cartesian product view | iterator
constexpr /*iterator*/& operator++(); | (1) | (C++23 起) |
constexpr void operator++( int ); | (2) | (C++23 起) |
constexpr /*iterator*/ operator++( int ) requires ranges::forward_range</*maybe-const*/<Const, First>>; | (3) | (C++23 起) |
constexpr /*iterator*/& operator--() requires /*cartesian-product-is-bidirectional*/<Const, First, Vs...>; | (4) | (C++23 起) |
constexpr /*iterator*/ operator--( int ) requires /*cartesian-product-is-bidirectional*/<Const, First, Vs...>; | (5) | (C++23 起) |
constexpr /*iterator*/& operator+=( difference_type n ) requires /*cartesian-product-is-random-access*/<Const, First, Vs...>; | (6) | (C++23 起) |
constexpr /*iterator*/& operator-=( difference_type n ) requires /*cartesian-product-is-random-access*/<Const, First, Vs...>; | (7) | (C++23 起) |
增加或减少迭代器。
令 current_
代表底层的迭代器元组,并令 parent_
代表指向 cartesian_product_view
的底层指针。
1) 等价于
next
();
return *this;2) 等价于 ++*this;
3) 等价于 auto tmp = *this; ++*this; return tmp;
4) 等价于
prev
();
return *this;5) 等价于 auto tmp = *this; --*this; return tmp;
6) 将 *this 的值设为
ret
,其中 ret
是: 若 n 不在范围 [
ranges::distance(*this, ranges::begin(*parent_)),
ranges::distance(*this, ranges::end(*parent_)))
中则行为未定义。7) 等价于 *this += -n; return *this;。
参数
n | - | 相对于当前位置的偏移 |
返回值
1,4,6,7)*this
2) (无)
3,5)*this 改变前的副本。
复杂度
6) 常数。
示例
本节未完成 原因:暂无示例 |
参阅
(C++23) | 进行迭代器算术 (函数) |