...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 Sequence is a Bidirectional Sequence whose iterators model Random Access Iterator. It guarantees constant time access to arbitrary sequence elements.
Notation
s
A Random Access Sequence
S
A Random Access Sequence type
N
o
An arbitrary object
e
A Sequence element
In addition to the requirements defined in Bidirectional Sequence, for any Random Access Sequence the following must be met:
Expression |
Return type |
Type Requirements |
Runtime Complexity |
---|---|---|---|
|
Constant |
||
|
Constant |
||
|
Any type |
Constant |
|
|
Any type |
|
Constant |
Expression |
Compile Time Complexity |
---|---|
|
Amortized constant time |
|
Amortized constant time |
|
Amortized constant time |
|
Amortized constant time |
The semantics of an expression are defined only where they differ from, or are not defined in Bidirectional Sequence.
std::pair
boost::array
vector
reverse_view
iterator_range
(where adapted sequence is a Random Access Sequence)
transform_view
(where adapted sequence is a Random Access Sequence)
zip_view
(where adapted sequences are models of Random Access Sequence)