# Sequence

### Description

A Sequence (or, more precisely, an Input Sequence) is a compile-time entity to which you can apply `begin`/`end` operations in order to get iterators for accessing the range of its elements. In general, a sequence does not guarantee that its content doesn't change from one iteration to another, or between different compilation sessions [1]. See Forward Sequence for the definition of the concept that imposes such additional requirements.

### Valid expressions

Expression | Expression type
--- | ---
`typename begin<s>::type` | A model of Input Iterator
`typename end<s>::type` | A model of Input Iterator

### Expression semantics

See the description of begin/end operations.

### Invariants

For any sequence `s` the following invariants always hold:

- `[begin<s>::type, end<s>::type)` is always a valid range;
- an algorithm that iterates through the range `[begin<s>::type, end<s>::type)` will pass through every element of `s` (once);
- `begin<s>::type` is identical to `end<s>::type` if and only if the sequence `s` is empty.

### Models

- `vector`
- `vector_c`
- `list`
- `list_c`
- `range_c`
- `iterator_range`

### Notes

[1] For example, a sequence might implement an interface to a compile-time random-number generator; for such sequence the `begin/end` invocation might return different iterators on every subsequent compilation of the code.

### See also

Sequences, Forward Sequence, Input Iterator, `begin`, `end`

Table of Contents
Last edited July 21, 2002 5:55 pm