##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::iterator

From cppreference.com
< cpp‎ | iterator

Defined in header `<iterator>` |  |
template< class Category, class T, class Distance = std::ptrdiff_t, class Pointer = T*, class Reference = T& > struct iterator; |  |

`std::iterator` is the base class provided to simplify definitions of the required types for iterators.

### [edit] Template parameters

Category | - | the category of the iterator. Must be one of iterator category tags.
T | - | the type of the values that can be obtained by dereferencing the iterator. This type should be `void` for output iterators.
Distance | - | a type that can be used to identify distance between iterators
Pointer | - | defines a pointer to the type iterated over (`T`)
Reference | - | defines a reference to the type iterated over (`T`)

### [edit] Member types

Member type | Definition
`value_type` | `T`
`difference_type` | `Distance`
`pointer` | `Pointer`
`reference` | `Reference`
`iterator_category` | `Category`

### [edit] See also

iterator_traits | provides uniform interface to the properties of an iterator (class template) [edit]
input_iterator_tag output_iterator_tag forward_iterator_tag bidirectional_iterator_tag random_access_iterator_tag | empty class types used to indicate iterator categories (class) [edit]

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/iterator/iterator&oldid=63259"