# Input Iterator

### Description

An Input Iterator is a Trivial Iterator that provides a way to obtain the next iterator in a sequence.

### Refinement of

Trivial Iterator

### Definitions

- an input iterator is past-the-end if it points beyond the last element of a sequence; past-the-end iterators are non-dereferenceable;
- an input iterator is valid if it is dereferenceable or past-the-end;
- an input iterator `i` is incrementable if there is a "next" iterator, that is, if `i::next` expression is well-defined; past-the-end iterators are not incrementable;
- an input iterator `j` is reachable from an input iterator `i` if, after recursive application of `next` operation to `i` a finite number of times, `i` is identical to `j`;
- the notation `[i,j)` refers to a range of iterators beginning with `i` and up to but not including `j`;
- the range `[i,j)` is a valid range if both `i` and `j` are valid iterators, and `j` is reachable from `i`.

### Valid expressions

In addition to the expressions defined in Trivial Iterator, the following expressions must be valid.

Expression | Expression type
--- | ---
`typename i::next` | A model of Input Iterator

### Expression semantics

Expression | Complexity | Precondition | Semantics | Postcondition
--- | --- | --- | --- | ---
`typename i::next` | Amortized constant time | `i` is incrementable | `i::next` is the next iterator in a sequence | `i::next` is dereferenceable or past-the-end

### See also

Sequence, Trivial Iterator, Forward Iterator

Table of Contents
Last edited April 21, 2003 4:14 pm