The New Algorithms

This lesson gives an overview of the new algorithms that are a part of C++17.

We'll cover the following...

The new algorithms are in the std namespace. std::for_each and std::for_each_n require the header <algorithm>, but the remaining 6 algorithms require the header <numeric>.

Here is an overview of the new algorithms:

Algorithm Description
std::for_each Applies a unary callable to the range.
std::for_each_n Applies a unary callable to the first n elements of the range.
std::exclusive_scan Applies from the left a binary callable up to the ith (exclusive) element of the range. The left argument of the callable is the previous result. Stores intermediate results.
std::inclusive_scan Applies from the left a binary callable up to the ith (inclusive) element of the range. The left argument of the callable is the previous result. Stores intermediate results.
std::transform_exclusive_scan First applies a unary callable to the range and then
...