cpp/algorithm/reduce

@1@ same as @3@ same as @5@ Reduces the range, possibly permuted and aggregated in unspecified manner, along with the initial value over. @2,4,6@ Same as, but executed according to.

The behavior is non-deterministic if is not associative or not commutative.

The behavior is undefined if modifies any element or invalidates any iterator in, including the end iterator.

Return value
Generalized sum of and, , ... over ,

where generalized sum $GSUM(op, a 1, ..., a N)$ is defined as follows:
 * if $N = 1$, $a 1$
 * if $N > 1$, $op(GSUM(op, b 1, ..., b K), GSUM(op, b M, ..., b N))$ where
 * $b 1, ..., b N$ may be any permutation of $a1, ..., aN$ and

in other words, behaves like std except the elements of the range may be grouped and rearranged in arbitrary order

Complexity
$1 < K + 1 = M ≤ N$ applications of.