The New Algorithms
The new algorithms are in the std
namespace. The algorithms std::for_each
and std::for_each_n
require the header <algorithm>
. The remaining six other 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. If the binary callable is non-associative the result is non-deterministic. |
 | Similar to std::partial_sum
|
std::inclusive_scan |
Applies from the left a binary callable up to the ith (inclusive) element of... |