]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/range/doc/reference/numeric/accumulate.qbk
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / range / doc / reference / numeric / accumulate.qbk
CommitLineData
7c673cae
FG
1[/
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)
5/]
6[section:accumulate accumulate]
7
8[heading Prototype]
9
10``
11template<
12 class SinglePassRange,
13 class Value
14 >
15Value accumulate(const SinglePassRange& source_rng,
16 Value init);
17
18template<
19 class SinglePassRange,
20 class Value,
21 class BinaryOperation
22 >
23Value accumulate(const SinglePassRange& source_rng,
24 Value init,
25 BinaryOperation op);
26``
27
28[heading Description]
29
30`accumulate` is a generalisation of summation. It computes a binary operation (`operator+`
31in the non-predicate version) of `init` and all of the elements in `rng`.
32
33The return value is the resultant value of the above algorithm.
34
35[heading Definition]
36
37Defined in the header file `boost/range/numeric.hpp`
38
39[heading Requirements]
40
41[heading For the first version]
42
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`.
47
48[heading For the second version]
49
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`.
56
57[heading Complexity]
58
59Linear. Exactly `distance(source_rng)`.
60
61[endsect]