| Home | Libraries | People | FAQ | More

#### Bidirectional Sequence

###### Description

A Bidirectional Sequence is a Forward Sequence whose iterators model Bidirectional Iterator.

###### Refinement of

Forward Sequence

Notation

`s`

  A Bidirectional Sequence

`S`

  A Bidirectional Sequence type

`o`

  An arbitrary object

`e`

  A Sequence element

###### Valid Expressions

In addition to the requirements defined in Forward Sequence, for any Bidirectional Sequence the following must be met:

Expression | Return type | Type Requirements | Runtime Complexity
--- | --- | --- | ---
``begin`(s)` | Bidirectional Iterator |  | Constant
``end`(s)` | Bidirectional Iterator |  | Constant
``back`(s)` | Any type |  | Constant
``back`(s) = o` | Any type | `s` is mutable and `e = o`, where `e` is the last element in the sequence, is a valid expression. | Constant

###### Result Type Expressions

Expression | Compile Time Complexity
--- | ---
``result_of::begin`<S>::type` | Amortized constant time
``result_of::end`<S>::type` | Amortized constant time
``result_of::back`<S>::type` | Amortized constant time

###### Expression Semantics

The semantics of an expression are defined only where they differ from, or are not defined in Forward Sequence.

Expression | Semantics
--- | ---
``back`(s)` | The last element in the sequence; see `back`.

###### Models

- `std::pair`
- `boost::array`
- `vector`
- `map`
- `reverse_view`
- `single_view`
- `iterator_range` (where adapted sequence is a Bidirectional Sequence)
- `transform_view` (where adapted sequence is a Bidirectional Sequence)
- `zip_view` (where adapted sequences are models of Bidirectional Sequence)