O'Reilly logo

C++ Crash Course by Josh Lospinoso

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

14ITERATORS

Say “friend” and enter.—J.R.R. Tolkein, The Lord of the Rings

Image

Iterators are the STL component that provides the interface between containers and algorithms to manipulate them. An iterator is an interface to a type that knows how to traverse a particular sequence and exposes simple, pointer-like operations to elements.

Every iterator supports at least the following operations:

  • Access the current element (operator*) for reading and/or writing
  • Go to the next element (operator++)
  • Copy construct

Iterators are categorized based on which additional operations they support. These categories determine which algorithms are available and what ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required