2 Copyright 2010 Neil Groves
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 [section:partial_sum partial_sum]
11 template<class SinglePassRange,
13 OutputIterator partial_sum(const SinglePassRange& rng,
14 OutputIterator out_it);
16 template<class SinglePassRange,
18 class BinaryOperation>
19 OutputIterator partial_sum(const SinglePassRange& rng,
20 OutputIterator out_it,
26 `partial_sum` calculates a generalised partial sum of `rng` in the same manner as
27 `std::partial_sum(boost::begin(rng), boost::end(rng), out_it)`. See __sgi_partial_sum__.
32 Defined in the header file `boost/range/numeric.hpp`
34 [heading Requirements]
36 [heading For the first version]
38 # `SinglePassRange` is a model of the __single_pass_range__ Concept.
39 # `OutputIterator` is a model of the `OutputIteratorConcept`.
40 # If `x` and `y` are objects of `SinglePassRange`'s value type, then `x + y` is defined.
41 # The return type of `x + y` is convertible to the value type of `SinglePassRange`.
42 # The value type of `SinglePassRange` is convertible to a type in `OutputIterator`'s set of value types.
44 [heading For the second version]
46 # `SinglePassRange` is a model of the __single_pass_range__ Concept.
47 # `OutputIterator` is a model of the `OutputIteratorConcept`.
48 # `BinaryOperation` is a model of the `BinaryFunctionConcept`.
49 # The result type of `BinaryOperation` is convertible to the value type of `SinglePassRange`.
50 # The value type of `SinglePassRange` is convertible to a type in `OutputIterator`'s set of value types.
52 [heading Precondition:]
54 `[result, result + distance(rng))` is a valid range.
58 Linear. If `empty(rng)` then zero applications, otherwise `distance(rng) - 1` applications are performed.