partial_sum [C++ Reference]
Keywords: stl,algorithm,partial_sum
Date: 2009-10-09T00:40:06-0700

[[partial_sum]]
C++ Reference
Translations of this page?:

- en
- br-pt
- cn
- cz
- de
- es
- fr
- it
- jp
- nl
- pl
- ro
- ru
- sk
- tr
- tw

## partial_sum

Syntax:

        #include <numeric>
        output_iterator partial_sum( input_iterator start, input_iterator end, output_iterator result );
        output_iterator partial_sum( input_iterator start, input_iterator end, output_iterator result, BinOp p );

The partial_sum() function calculates the partial sum of a range defined by [start,end), storing the output at result.

start is assigned to *result, the sum of *start and *(start + 1) is assigned to *(result + 1), etc.

partial_sum() runs in linear time.

Related Topics: accumulate, adjacent_difference, count, inner_product

Edit this page • Old revisions
• • • Login • Index • Recent changes • RSS • cc •