...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
A Random Access Iterator traverses a Sequence moving in either direction, permitting efficient arbitrary distance movements back and forward through the sequence.
Notation
Random Access Iterators
Random Access Iterator types
An MPL integral constant
An integral constant
In addition to the requirements defined in Bidirectional Iterator, the following expressions must be valid:
Expression |
Return type |
Runtime Complexity |
---|---|---|
next(i) |
Constant |
|
prior(i) |
Constant |
|
advance_c<N>(i) |
Constant |
|
advance<M>(i) |
Constant |
Expression |
Compile Time Complexity |
---|---|
result_of::advance_c<I, N>::type |
Amortized constant time |
result_of::advance<I, M>::type |
Amortized constant time |
result_of::distance<I ,J>::type |
Amortized constant time |