Iterators

Fundamental to the use of the STL is the idea of an iterator. You will recall that we discussed iterators briefly in the previous chater. An iterator is used to solve one basic problem, how do you allow access to elements in a container without exposing the inner working of the collection?

The iterator solution is to define a new data type specifically for creating loops, and accesssing elements.

The majority of the algorithms provided by the STL are build using iterators as arguments, and thus can work with a number of different data structures.

[audio] [real] Text to accompany slide4, in Chapter 16 of An Introduction to Object-Oriented Programming