absl::c_partial_sum

Overload of c_partial_sum() for using a binary operation other than addition to compute the "partial sum".

Synopsis

Declared in <absl/algorithm/container.h>

template<
    typename InputSequence,
    typename OutputIt,
    typename BinaryOp>
constexpr
OutputIt
c_partial_sum(
    InputSequence const& input,
    OutputIt output_first,
    BinaryOp&& op);

Return Value

An iterator to the end of the written range in the output.

Parameters

NameDescription
inputThe container whose elements to sum.
output_firstThe output iterator receiving the partial sums.
opThe binary operation used to combine values.