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:accumulate accumulate]
12 class SinglePassRange,
15 Value accumulate(const SinglePassRange& source_rng,
19 class SinglePassRange,
23 Value accumulate(const SinglePassRange& source_rng,
30 `accumulate` is a generalisation of summation. It computes a binary operation (`operator+`
31 in the non-predicate version) of `init` and all of the elements in `rng`.
33 The return value is the resultant value of the above algorithm.
37 Defined in the header file `boost/range/numeric.hpp`
39 [heading Requirements]
41 [heading For the first version]
43 # `SinglePassRange` is a model of the __single_pass_range__ Concept.
44 # `Value` is a model of the `AssignableConcept`.
45 # An `operator+` is defined for a left-hand operand of type `Value` and a right-hand operand of the `SinglePassRange` value type.
46 # The return type of the above operator is convertible to `Value`.
48 [heading For the second version]
50 # `SinglePassRange` is a model of the __single_pass_range__ Concept.
51 # `Value` is a model of the `AssignableConcept`.
52 # `BinaryOperation` is a model of the `BinaryFunctionConcept`.
53 # `Value` is convertible to `BinaryOperation`'s first argument type.
54 # `SinglePassRange`'s value type is convertible to `BinaryOperation`'s second argument type.
55 # The return type of `BinaryOperation` is convertible to `Value`.
59 Linear. Exactly `distance(source_rng)`.