std:: incrementable
| Iterator concepts | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Iterator primitives | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Algorithm concepts and utilities | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Indirect callable concepts | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Common algorithm requirements | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Utilities | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Iterator adaptors | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
定义于头文件
<iterator>
|
||
|
template
<
class
I
>
concept incrementable
=
|
(C++20 起) | |
此概念规定了类型需满足前置与后置递增运算符的要求,其递增操作需 保持相等性 ,且该类型需满足 std::equality_comparable 。
与仅支持单遍算法的
std::weakly_incrementable
不同,对于满足
std::incrementable
概念的类型,可以使用多遍单向算法。
语义要求
I
仅当对于类型
I
的任意两个可递增对象
a
和
b
满足以下条件时,才建模
std::incrementable
:
- bool ( a == b ) 意味着 bool ( a ++ == b ) ,且
- bool ( a == b ) 意味着 bool ( ( ( void ) a ++ , a ) == ++ b ) 。
等值保持性
标准库概念的 requires 表达式 中声明的表达式必须满足 等值保持 要求(除非另有说明)。
参见
|
(C++20)
|
规定
semiregular
类型可通过前置与后置自增运算符进行递增
(概念) |
|
(C++20)
|
规定某类型与另一类型相同
(概念) |