The Iterator
concept describes types that can be used to identify and traverse the elements of a container.
Iterator
is the base concept used by other iterator types: InputIterator
, OutputIterator
, ForwardIterator
, BidirectionalIterator
, and RandomAccessIterator
. Iterators can be thought of as an abstraction of pointers.
The type It
satisfies Iterator
if.
It
satisfies CopyConstructible
, and It
satisfies CopyAssignable
, and It
satisfies Destructible
, and It
satisfy Swappable
, and std::iterator_traits<It>
has member typedefs value_type
, difference_type
, reference
, pointer
, and iterator_category
, and Given.
r
, an lvalue of type It
. The following expressions must be valid and have their specified effects:
Expression | Return Type | Precondition |
---|---|---|
*r | unspecified |
r is dereferenceable (see below) |
++r |
It& |
r is incrementable (the behavior of the expression ++r is defined) |
Iterators for which the behavior of the expression *i
is defined are called dereferenceable.
Iterator
s are not dereferenceable if.
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/concept/Iterator