Partial_sum is an overloaded name; there are actually two partial_sum
functions.
template <class InputIterator, class OutputIterator>
OutputIterator partial_sum(InputIterator first, InputIterator last,
OutputIterator result);
template <class InputIterator, class OutputIterator, class BinaryOperation>
OutputIterator partial_sum(InputIterator first, InputIterator last,
OutputIterator result, BinaryOperation binary_op);
Description
Partial_sum calculates a generalized partial sum: *first is assigned
to *result, the sum of *first and *(first + 1) is assigned to
*(result + 1), and so on. [1]
More precisely, a running sum is first initialized to *first and
assigned to *result. For each iterator i in [first + 1, last), in
order from beginning to end, the sum is updated by sum = sum + *i
(in the first version) or sum = binary_op(sum, *i) (in the second
version) and is assigned to *(result + (i - first)). [2]