Most container classes have iterators supplied with them that allow you to move through the range and obtain successive references to elements contained within it. You’ve seen iterators all through the discussion of the STL algorithms, but they are also available to the programmer.
The main iterators are begin, end, rbegin, and rend. These iterators provide the functionality to specify the end points of the range that you want to examine. You can move through the range of elements without knowing anything else about either the range or the elements.
One example of this uses a for loop that starts at ::begin and goes to ::end, returning the container class type at each step. For example:
for ( element = my_string.begin( ) ; element ...