Reduce
We often need to reduce a numeric range. That is where std::reduce comes in handy.
We'll cover the following
The six new algorithms that are typically used for parallel execution are also known under the name prefix sum. If the given binary callables are not associative and commutative, the behavior of the algorithms is undefined.
reduce
This reduces the elements of the range. init
is the start value.
- Behaves the same as
std::accumulate
but the range may be rearranged.
Get hands-on with 1200+ tech skills courses.