The <algorithm> header file contains algorithms, with some of them implemented as higher-order functions. In this book, we have seen examples of use for many of them. Here's a list of useful algorithms:
- all_of, any_of, and none_of
- find_if and find_if_not
- count_if
- copy_if
- generate_n
- sort
We have seen how focusing on data and combining these higher-order functions to transform input data into the desired output is one of the ways in which you can think in small, composable, pure functions. We have also seen the drawbacks of this approach—the need to copy data, or make multiple passes through the same data—and we have seen how the new ranges library solves these issues in an elegant manner.
While all of these functions are extremely useful, there is one function from the <algorithm> namespace that deserves a special mention...