Standard C++ Library Class Reference

Containers and sequences must also provide const iterators to the beginning and end of their
collections. These may be accessed using the class members, begin() and end().
The semantics of iterators are a generalization of the semantics of C++ pointers. Every template
function that takes iterators will work using C++ pointers for processing typed contiguous
memory sequences.
Iterators may be constant or mutable depending upon whether the result of the operator*
behaves as a reference or as a reference to a constant. Constant iterators cannot satisfy the
requirements of an output_iterator.
Every iterator type guarantees that there is an iterator value that points past the last element of a
corresponding container. This value is called the past-the-end value. No guarantee is made that
this value is dereferencable.
Every function provided by an iterator is required to be realized in amortized constant time.
Key to Iterator Requirements
The following key pertains to the iterator requirements listed below:
a and b values of type X
n value of distance type
u, Distance, tmp and m identifiers
r value of type X&
t value of type T
Requirements for Input Iterators
The following expressions must be valid for input iterators:
X u(a) copy constructor, u == a
X u = a assignment, u == a
a == b, a != b
return value convertible to bool
*a a == b implies *a == *b
a->m equivalent to (*a).m
++r returns X&
r++ return value convertible to const X&
*r++ returns type T