cpp/named req/ForwardIterator

A is a  that can read data from the pointed-to element.

Unlike and, it can be used in multipass algorithms.

If a  originates from a, then 's  is the same as the container's, so dereferencing  obtains the container's.

Requirements
The type satisfies  if


 * The type satisfies
 * The type satisfies
 * Objects of the type provide multipass guarantee described below
 * Let be the value type of . The type  must be either
 * if satisfies  ( is mutable), or
 * otherwise ( is constant),
 * (where is the type denoted by )


 * Equality and inequality comparison is defined over all iterators for the same underlying sequence.

And, given
 * , dereferenceable lvalue of type
 * , the type denoted by

The following expressions must be valid and have their specified effects

A mutable is a  that additionally satisfies the  requirements.

Multipass guarantee
Given and, dereferenceable iterators of type


 * If and  compare equal ( is contextually convertible to ) then either they are both non-dereferenceable or  and  are references bound to the same object.
 * If and  refer to the same object, then.
 * Assignment through a mutable iterator cannot invalidate the iterator (implicit due to  defined as a true reference).
 * Incrementing a copy of does not change the value read from  (formally, either  is a raw pointer type or the expression  is equivalent to the expression ).
 * implies.

{{rev|since=c++14|

Singular iterators
A value-initialized behaves like the past-the-end iterator of some unspecified empty container: it compares equal to all value-initialized s of the same type.}}

{{rrev | since=c++20 |

Concept
For the definition of std, the following exposition-only concept is defined.

where the exposition-only concept is described in. }}