std::ranges::stride_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 起) |
| |
(7) | (C++23 起) |
增加或减小迭代器。
令 current_,end_,stride_,与 missing_ 为迭代器的数据成员,
2) 等价于
++*this;。3) 等价于
auto tmp = *this; ++*this; return tmp;。4) 等价于
ranges::advance(current_, missing_ - stride_);
missing_ = 0;
return *this;
5) 等价于
auto tmp = *this; --*this; return tmp;。6) 等价于
if (n > 0)
{
ranges::advance(current_, stride_ * (n - 1));
missing_ = ranges::advance(current_, stride_, end_);
}
else if (n < 0)
{
ranges::advance(current_, stride_ * n + missing_);
missing_ = 0;
}
return *this;
如果 n > 0,那么调用此函数前 ranges::distance(current_, end_) 必须大于 stride_ * (n - 1)。
n < 0,那么 ranges::distance(current_, end_) 总是大于(非正)stride_ * (n - 1)。7) 等价于
return *this += -n;参数
| n | - | 相对于当前位置的位移 |
返回值
1,4,6,7)
*this2) (无)
3,5)
*this 被修改前的副本示例
| 本节未完成 原因:暂无示例 |
参阅
(C++23) |
performs iterator arithmetic (函数) |