Search⌘ K
AI Features

`std::iterator` Is Deprecated

Explore the deprecation of std::iterator in C++17 and learn how to define custom iterators by explicitly writing typedefs. This lesson helps you understand improved practices in iterator definitions that enhance code readability and reduce errors.

We'll cover the following...

The Standard Library API requires that each iterator type has to expose five typedefs:

  • iterator_category - the type of the iterator
  • value_type - type stored in the iterator
  • difference_type - the type that is the result of subtracting two iterators
  • pointer - pointer type of the stored type
  • reference - the reference type of the stored type

iterator_category must be one of ...