Daily bit(e) of C++ | std::inner_product
Daily bit(e) of C++ #300, The left-fold reduction over two ranges: std::inner_product.
The std::inner_product is a left-fold reduction algorithm that, in each step, first reduces the current elements from both ranges into a single value and then folds the result into an accumulator.
The reduction and accumulation operations can be customized and, due to the strict left-to-right operation, are allowed to have state and side effects.