std:: weakly_incrementable
| Iterator concepts | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Iterator primitives | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Algorithm concepts and utilities | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Indirect callable concepts | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Common algorithm requirements | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Utilities | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Iterator adaptors | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
定义于头文件
<iterator>
|
||
|
template
<
class
I
>
concept weakly_incrementable
=
|
(C++20 起) | |
关于
/*is-signed-integer-like*/
的定义,请参阅
is-integer-like
。
此概念规定了可通过前置与后置递增运算符进行自增的类型要求,但这些递增操作不一定是 保等性的 ,且类型本身不要求满足 std::equality_comparable 。
对于
std::weakly_incrementable
类型,
a
==
b
并不意味
++
a
==
++
b
成立。针对弱可递增类型的算法必须是单遍算法。这些算法可通过
std::istream_iterator
将输入流作为数据源使用。
语义要求
对于类型为
I
的对象
i
,当且仅当满足以下所有条件时,
I
才满足
std::weakly_incrementable
概念:
- 表达式 ++ i 与 i ++ 具有相同的定义域。
- 若 i 可递增,则 ++ i 与 i ++ 均会使 i 向前推进。
- 若 i 可递增,则 std:: addressof ( ++ i ) == std:: addressof ( i ) 。
缺陷报告
下列行为变更缺陷报告被追溯应用于先前发布的 C++ 标准。
| 缺陷报告 | 应用于 | 发布时行为 | 正确行为 |
|---|---|---|---|
| P2325R3 | C++20 |
要求具备
default_initializable
|
不作要求 |
参见
|
(C++20)
|
规定对
weakly_incrementable
类型的递增操作是
保等性的
,且该类型是
equality_comparable
(概念) |