9 Iterators library [iterators]

9.3 Iterator requirements [iterator.requirements]

9.3.7 Concept Incrementable [iterators.incrementable]

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 EqualityComparable. [ Note: This requirement supersedes the annotations on the increment expressions in the definition of WeaklyIncrementable.  — end note ]

  template <class I>
  concept bool Incrementable =
    Regular<I> &&
    WeaklyIncrementable<I> &&
    requires(I i) {
      { i++ } -> Same<I>&&;
    };

Let a and b be incrementable objects of type I. Incrementable<I> is satisfied only if

  • If bool(a == b) then bool(a++ == b).

  • If bool(a == b) then bool((a++, a) == ++b).

Note: The requirement that a equals b implies ++a equals ++b (which is not true for weakly incrementable types) allows the use of multi-pass one-directional algorithms with types that satisfy Incrementable. — end note ]