[iterator.concept.inc] (original) (raw)
23 Iterators library [iterators]
23.3 Iterator requirements [iterator.requirements]
23.3.4 Iterator concepts [iterator.concepts]
23.3.4.5 Concept incrementable [iterator.concept.inc]
The incrementable concept specifies requirements on types that can be incremented with the pre- and post-increment operators.
The increment operations are required to be equality-preserving, and the type is required to be equality_comparable.
[ Note
:
This supersedes the annotations on the increment expressions in the definition of weakly_incrementable.
— end note
]
template concept incrementable = regular && weakly_incrementable && requires(I i) { { i++ } -> same_as; };
Let a and b be incrementable objects of type I.
I models incrementable only if
- If bool(a == b) then bool(a++ == b).
- If bool(a == b) then bool(((void)a++, a) == ++b).
[ Note
:
The requirement thata equals bimplies++a equals ++b(which is not true for weakly incrementable types) allows the use of multi-pass one-directional algorithms with types that model incrementable.
— end note
]