std::ranges::chunk_view<V>::iterator<Const>::operator++,--,+=,-=
来自cppreference.com
| |
(1) | (C++23 起) |
| |
(2) | (C++23 起) |
| |
(3) | (C++23 起) |
| |
(4) | (C++23 起) |
| |
(5) | (C++23 起) |
| |
(6) | (C++23 起) |
递增或递减迭代器。
令 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)
*this2,4)
*this 被修改前的副本示例
| 本节未完成 原因:暂无示例 |
参阅
(C++23) |
执行迭代器算术 (函数) |