Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
Front Page / Iterators / Concepts / Forward Iterator

Forward Iterator


A Forward Iterator i is a type that represents a positional reference to an element of a Forward Sequence. It allows to access the element through a dereference operation, and provides a way to obtain an iterator to the next element in a sequence.


Expression requirements

Expression Type Complexity
deref<i>::type Any type Amortized constant time
next<i>::type Forward Iterator Amortized constant time
i::category Integral Constant, convertible to forward_iterator_tag Constant time

Expression semantics

typedef deref<i>::type j;
Precondition:i is dereferenceable
Semantics:j is identical to the type of the pointed element
typedef next<i>::type j;
Precondition:i is incrementable
Semantics:j is the next iterator in a sequence
Postcondition:j is dereferenceable or past-the-end
typedef i::category c;
Semantics:c is identical to the iterator's category tag


For any forward iterators i and j the following invariants always hold:

See also

Iterators, Bidirectional Iterator, Forward Sequence, deref, next