26 Numerics library [numerics]

26.8 Generalized numeric operations [numeric.ops]

26.8.4 Transform reduce [transform.reduce]

template<class InputIterator, class UnaryFunction, class T, class BinaryOperation> T transform_reduce(InputIterator first, InputIterator last, UnaryOperation unary_op, T init, BinaryOperation binary_op); template<class ExecutionPolicy, class InputIterator, class UnaryFunction, class T, class BinaryOperation> T transform_reduce(ExecutionPolicy&& exec, InputIterator first, InputIterator last, UnaryOperation unary_op, T init, BinaryOperation binary_op);

Requires: Neither unary_op nor binary_op shall invalidate subranges, or modify elements in the range [first, last).

Returns: GENERALIZED_SUM(binary_op, init, unary_op(*i), ...) for every i in [first, last).

Complexity: Ο(last - first) applications each of unary_op and binary_op.

Notes: transform_reduce does not apply unary_op to init.