std::ranges::chunk_view<V>::iterator<Const>::operator++,--,+=,-=
来自 zh.cppreference.net
constexpr /*iterator*/& operator++();
|
(1) | (自C++23起) |
constexpr /*iterator*/ operator++( int );
|
(2) | (自C++23起) |
constexpr /*iterator*/& operator--()
requires ranges::bidirectional_range<Base>;
|
(3) | (自C++23起) |
constexpr /*iterator*/ operator--( int )
requires ranges::bidirectional_range<Base>;
|
(4) | (自C++23起) |
constexpr /*iterator*/& operator+=( difference_type x )
requires ranges::random_access_range<Base>;
|
(5) | (自C++23起) |
constexpr /*iterator*/& operator-=( difference_type x )
requires ranges::random_access_range<Base>;
|
(6) | (自C++23起) |
前进或后退 iterator。
令 current_, end_,和 n_ 是底层的 数据成员 的 chunk_view::iterator。
1) 等价于:
调用前,表达式
missing_ = ranges::advance(current_, n_, end_);
return *this;
current_ != end_ 必须为 true,否则行为未定义。2) 等价于:
auto tmp = *this; ++*this; return tmp;。3) 等价于:
ranges::advance(current_, missing_ - n_);
missing_ = 0;
return *this;
4) 等价于:
auto tmp = *this; --*this; return tmp;。5) 等价于:
如果
if (x > 0)
{
ranges::advance(current_, n_ * (x - 1));
missing_ = ranges::advance(current_, n_, end_);
}
else if (x < 0)
{
ranges::advance(current_, n_ * x + missing_);
missing_ = 0;
}
return *this;
x 为正,则调用前表达式 ranges::distance(current_, end_) > n_ * (x - 1) 必须为 true (即,非正式地,请求的块应在基础序列“内部”)。如果 x 为负,此前提条件始终满足。6) 等价于:
return *this += -x;。参数
| x | - | 相对于当前位置的偏移量 |
返回值
1,3,5,6)
*
this
2,4)
在更改前创建的
*
this
副本
示例
|
本节内容不完整
原因:缺少示例 |
参见
|
(C++23)
|
执行迭代器算术运算
(函数) |