...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Front Page / Iterators / Concepts / Random Access Iterator |
A Random Access Iterator is a Bidirectional Iterator that provides constant-time guarantees on moving the iterator an arbitrary number of positions forward or backward and for measuring the distance to another iterator in the same sequence.
In addition to the requirements defined in Bidirectional Iterator, the following requirements must be met.
Expression | Type | Complexity |
---|---|---|
next<i>::type | Random Access Iterator | Amortized constant time |
prior<i>::type | Random Access Iterator | Amortized constant time |
i::category | Integral Constant, convertible to random_access_iterator_tag | Constant time |
advance<i,n>::type | Random Access Iterator | Amortized constant time |
distance<i,j>::type | Integral Constant | Amortized constant time |
typedef advance<i,n>::type j;
Semantics: | See advance specification |
---|
typedef distance<i,j>::type n;
Semantics: | See distance specification |
---|
For any random access iterators i and j the following invariants always hold: