Iterators
Lesson 3 of 23 in Coddy's C++ - Standard Template Library course.
The C++ STL provides us with the ability to point at the memory addresses of the containers, variables and data structures. They help us during solving of a problem and they reduce the execution time and complexity of the program itself.
When an iterator N is pointing to a valid object you can dereference it to obtain a reference to the object it self by writing *N.
We mostly use iterators when we need to go through a sequence of numbers, characters or any kind of elements.
Iterators in C++ are divided in 5 major categories based on their functionality:
- Input Iterators (read a sequence of values)
- Output Iterators (used to write a sequence of values)
- Forward Iterators (can be read, written to and move forward)
- Bidirectional Iterators (like forward iterators, but can also move back)
- Random-Access Iterators (can move freely any number of times)
Try it yourself
This lesson doesn't include a code challenge.