Using iterators

So far, in this chapter we have indicated that containers give access to items through iterators. The implication is that iterators are simply pointers, and this is deliberate because iterators behave like pointers. However, they are usually objects of iterator classes (see the <iterator> header). All iterators have the following behaviors:

Operator Behaviors
* Gives access to the element at the current position
++ Moves forward to the next element (usually you will use the prefix operator)(this is only if the iterator allows forward movement)
-- Moves backward to the previous element (usually you will use the prefix operator)(this is only if the iterator allows backward movement)
== and != Compares if two iterators ...

Get Modern C++: Efficient and Scalable Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.