From Cppreference
Iterators are a generalization of pointers that allow C++ programs to access different containers in a uniform manner. Any algorithm that accepts iterators should accept regular pointers also.
[edit] Iterator Types
Five iterator categories are defined, according to operations defined on them:
|
- allows reading from the iterator object
- allows iterating forward without multi-pass guarantee, i. e. reading the same element twice is not guaranteed to produce the same results
|
|
- allows writing to the iterator object
- allows iterating forward without multi-pass guarantee
|
|
- allows reading from the iterator object
- allows iterating forward with multi-pass guarantee, i. e. reading the same element twice is guaranteed to produce the same results
|
|
- allows reading from the iterator object
- allows iterating forward and backward with multi-pass guarantee
|
|
- allows reading from the iterator object
- allows iterating forward and backward randomly with multi-pass guarantee
|
Forward iterators satisfy the requirements of input iterators
[edit] Iterator Operations
|
|
advances an iterator by given distance (function)
|
|
|
returns the distance between two iterators (function)
|
|
|
increment an iterator (function)
|
|
|
decrement an iterator (function)
|
[edit] Predefined Iterators
reverse_iterator, insert_iterator, move_iterator
[edit] Stream Iterators
istream_iterator, ostream_iterator, istreambuf_iterator
[edit] Range Access
|
|
returns an iterator to the beginning of a container or array (function)
|
|
|
returns an iterator to the end of a container or array (function)
|