C++ concepts: ForwardIterator
From cppreference.com
A ForwardIterator is an Iterator that can read data from the pointed-to element.
Unlike an InputIterator, it guarantees validity when used in multipass algorithms.
[edit] Requirements
-
InputIterator -
DefaultConstructible -
a == bimplies++a == ++b
In addition to the above requirements, for a type It to be an ForwardIterator, an instance i of It must:
| Expression | Return | Equivalent expression | Notes |
|---|---|---|---|
| ++i | iterator | i=std::next(i); return i; | After this, copies of i are still valid
|
| i++ | iterator | iterator ip=i; i=std::next(i); return ip; | |
| *i++ | reference | value_type& temp=*i; ++i; return temp; |
A mutable ForwardIterator is a ForwardIterator that additionally satisfies the OutputIterator requirements.
A value-initialized ForwardIterator behaves like the past-the-end iterator of some unspecified empty container: it compares equal to all value-initialized ForwardIterators of the same type. (since C++14)