Chapter 29. Using Iterators and Containers

  • Learn about iterators and why they’re useful

  • Explore iterator operations and classes

  • See the differences between sequence containers and associative containers

  • Examine the standard container classes


Understanding Iterators

Iterators and containers are closely related. Conceptually, an iterator is something that an algorithm can use to traverse the sequence of objects in a container; an iterator knows how to iterate through the contents of a container. Standard Template Library (STL) container classes such as vector, list, and map all use iterators to represent container elements. The generic algorithms provided by the standard library work with the generic containers, but not all algorithms ...

Get Practical C++ now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.