O'Reilly logo

The C++ Standard Library: A Tutorial and Reference by Nicolai M. Josuttis

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

Chapter 9. STL Algorithms

This chapter describes all of the algorithms of the C++ standard library. It begins with an overview of all algorithms and some general remarks about the algorithms. It then presents the exact signature of each algorithm and one or more examples of its use.

Algorithm Header Files

To use the algorithms of the C++ standard library you must include the header file <algorithm>[1]:

   #include <algorithm>

This header file also includes some auxiliary functions. min(), max(). and swap() were presented in Section 4.4.1, and Section 4.4.2. The iter_swap() iterator function was discussed in Section 7.3.3.

Some of the STL algorithms are provided for numeric processing. Thus, they are defined in <numeric>[1]:

   #include <numeric>

In general, ...

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