O'Reilly logo

Beginning C++ Programming by Richard Grimes

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required