![]() |
Home | Libraries | People | FAQ | More |
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
S
N
o
e
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 |
---|---|---|---|
|
Random Access Iterator | Constant | |
|
Random Access Iterator | Constant | |
|
Any type | Constant | |
|
Any type |
s
is mutable and e = o ,
where e is the first
element in the sequence, is a valid expression. |
Constant |
Expression | Compile Time Complexity |
---|---|
|
Amortized constant time |
|
Amortized constant time |
|
Amortized constant time |
|
Amortized constant time |
returns the actual type returned by
result_of::at
<S, N>
. In
most cases, this is a reference. Hence, there is no way to know the exact
element type using at
<N>(s)
.The element at result_of::at
<S, N>N
may actually be a reference to begin with. For this purpose, you can use
.
result_of::value_at
<S, N>
The semantics of an expression are defined only where they differ from, or are not defined in Bidirectional Sequence.
std::pair
boost::array
vector
iterator_range
(where adapted sequence is a Random Access Sequence)
transform_view
(where adapted sequence is a Random Access Sequence)
reverse_view
Copyright © 2001-2007 Joel de Guzman, Dan Marsden, Tobias Schwinger |