Useful Functions

C++ offers several tools to make the iteration process simpler and safer.

We'll cover the following...

The global functions std::begin, std::end, std::prev, std::next, std::distance, and std::advance make handling of the iterators a lot easier. Only the function std::prev requires a bidirectional iterator. All functions need the header <iterator>. The table gives an overview:

Global function
...