Whenever you start working with complicated data structures, you encounter the problem of traversal. This can be handled in different ways, but the most common way of traversing, say, a vector is using something called an iterator.
An iterator is, quite simply, an object that can point to an element of a collection and also knows how to move to the next element in the collection. As such, it is only required to implement the ++ operator and the != operator (so you can compare two iterators and check if they point to the same thing). That’s it.
The C++ Standard Library makes heavy use ...