In this section of the course we're going to take a look at the iterator design pattern and this design
pattern essentially facilitates the traversal of different data structures.
So the motivation for using the iterator is very simple because the iterator function is a core functionality
of various containers and the data structure.
So the iterate tour is quite simply a class or it's typically a class that facilitates the traversal
and it does there.
So by doing two things.
First of all it keeps a reference or a pointer indeed to the current element the element that's currently
being looked at and it knows how to move from one element to a different element that's all that an
iterator typically is now in many cases you would use an iterator explicitly by instantiating it and
then doing operator plus plus on it.
But it can also be used implicitly.
There are lots of cases where you're using iterators without really knowing that you're using them so
for example if you use a range based for loop what you're essentially getting easier is getting a reference
to the final value.
But behind the scenes iterators being used iterators getting their operator plus plus invoked and so
on but you don't see any of it.
Another example is coroutines that's also something where you have a method which returns a generator
but the generator actually gives you the the ability to iterate itself and you don't see the iterators
explicitly in this case either.
So the iterator pattern is quite simply the idea that you have some sort of object which facilitates
the traversal of a particular data structure.