名稱空間
變體
操作

std::ranges::cartesian_product_view<First, Vs...>::iterator<Const>::operator++,--,+=,-=

來自 cppreference.com
 
 
範圍庫 (Ranges library)
範圍介面卡 (Range adaptors)
 
 
constexpr /*迭代器*/& 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 > 0,則為 *this 的值,前提是 next 已被呼叫 n 次。否則,
  • 如果 n < 0,則為 *this 的值,前提是 prev 已被呼叫 -n 次。否則,
  • 呼叫前 *this 的值。
如果 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) 常數時間。

[編輯] 示例

[編輯] 參閱

進行迭代器算術
(函式)