...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
M
An MPL integral constant
N
An integral constant
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 |
|
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.
Expression |
Semantics |
---|---|
|
The Mth element from the beginning of the sequence; see |
|
The Nth element from the beginning of the sequence; see |
std::pair
boost::array
vector
map
reverse_view
single_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)