partial_sum

Computes the partial sum of a sequence of numbers.

  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);
  

The first computes the partial sum and sends it to the output iterator argument.

x, y, z

x, x+y, y+z.

The second form computes according to the operational argument and sends it to the output iterator argument. For example if the operational argument was a multiplication operation

x, y, z

x, x*y, y*z

Remarks

The range as the result plus the last minus the first.