Iterators
In this chapter, we've mentioned multiple times that elements have a position in a container: for example, we said that we can insert an element in a specific position in a list.
Iterators are the way in which the position of an element in a container is represented.
They provide a consistent way to operate on elements of the container, abstracting the details of the container to which the elements belong.
An iterator always belongs to a range. The iterator representing the start of the range, can be accessed by the begin() function, while the iterator representing the end of the range, non-inclusive, can be obtained with the end() function. The range where the first element is included, but where the last one is excluded, is referred to as half-open.
The interface that the iterator must offer is composed of four functions:
The * operator provides access to the element at the position currently referenced by the iterator.
The ++ operator is used to move forward to the next element.
Then...