std::ranges::chunk_view<V>:: iterator <Const>:: operator++,--,+=,-=
From cppreference.net
<
cpp
|
ranges
|
chunk view
|
iterator
C++
Ranges library
|
||||||||||||||||||||||
| Range primitives | |||||||
|
|||||||
| Range concepts | |||||||||||||||||||
|
|||||||||||||||||||
| Range factories | |||||||||
|
|||||||||
| Range adaptors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||
| Helper items | |||||||||||||||||
|
|
||||||||||||||||
std::ranges::chunk_view
| Member functions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
(C++26)
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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 起) |
前进或递减 迭代器 。
令
current_
、
end_
和
n_
为
chunk_view::iterator
的底层
数据成员
。
1)
等价于:
调用前必须满足表达式
current_
!
=
end_
为
true
,否则行为未定义。
missing_ = ranges::advance(current_, n_, end_); return *this;
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)
等价于:
若
x
为正数,则在调用前必须满足表达式
ranges::
distance
(
current_, end_
)
>
n_
*
(
x
-
1
)
为
true
(即非正式地说,请求的块应位于底层序列"内部")。若
x
为负数,此前置条件始终满足。
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;
6)
等价于:
return
*
this
+
=
-
x
;
。
目录 |
参数
| x | - | 相对于当前位置的偏移量 |
返回值
1,3,5,6)
*
this
2,4)
在更改前创建的
*
this
副本
示例
|
本节内容不完整
原因:缺少示例 |
参见
|
(C++23)
|
执行迭代器算术运算
(函数) |