##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# C++ concepts: InputIterator

From cppreference.com
< cpp‎ | concept

An `InputIterator` is an `Iterator` that can read from the pointed-to element. `InputIterator`s only guarantee validity for single pass algorithms: once an `InputIterator` i has been incremented, all copies of its previous value may be invalidated.

### [edit] Requirements

- `Iterator`
- `EqualityComparable`

In addition to the above requirements, for a type It to be an `InputIterator`, instances i and j of It must:

Expression | Return | Equivalent expression | Notes
--- | --- | --- | ---
i != j | contextually convertible to bool | !(i == j) | Precondition: (i, j) is in the domain of ==.
*i | convertible to value_type | If i == j and (i, j) is in the domain of == then this is equivalent to *j. | Precondition: i is dereferenceable. The expression (void)*i, *i is equivalent to *i.
i->m |  | (*i).m | Precondition: i is dereferenceable.
++i | It& |  | Precondition: i is dereferenceable. Postcondition: i is dereferenceable or i is past-the-end. Postcondition: Any copies of the previous value of i are no longer required to be either dereferenceable or to be in the domain of ==.
(void)i++ |  | (void)++i |
*i++ | convertible to value_type | value_type x = *i; ++i; return x; |

### [edit] See also

- Iterator library

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/concept/InputIterator&oldid=63708"