The iterator type must be a model of .
A random access iterator is an iterator that can read through
a sequence of values. It can move in either direction through the
sequence (by any amount in constant time), and can be either mutable
(data pointed to by it can be changed) or not mutable.
An iterator represents a position in a sequence. Therefore,
the iterator can point into the sequence (returning a value when
dereferenced and being incrementable), or be off-the-end (and not
dereferenceable or incrementable).
The value type of the iterator
The category of the iterator
The difference type of the iterator (measure of the number
of steps between two iterators)
Equivalent to applying i++
n
times
if n
is positive, applying i--
-n
times if n
is negative, and to a null
operation if n
is zero.
Equivalent to applying i++
n
times
if n
is positive, applying i--
-n
times if n
is negative, and to a null
operation if n
is zero.
Equivalent to i+=(-n)
Equivalent to i+=(-n)
Equivalent to {Iter j = i; j += n; return j;}
Equivalent to {Iter j = i; j += n; return j;}
Equivalent to i + n
Equivalent to i + n
Equivalent to i + (-n)
Equivalent to i + (-n)
The number of times i
must be incremented (or
decremented if the result is negative) to reach j
. Not
defined if j
is not reachable from
i
.
Equivalent to *(i + n)
Equivalent to *(i + n)
All iterator operations must take amortized constant time.