2010-03-28 16:08:35 +00:00
< html >
< head >
< meta http-equiv = "Content-Type" content = "text/html; charset=US-ASCII" >
< title > accumulate< / title >
2010-07-13 20:31:40 +00:00
< link rel = "stylesheet" href = "../../../../../../../../doc/src/boostbook.css" type = "text/css" >
< meta name = "generator" content = "DocBook XSL Stylesheets V1.75.2" >
2010-03-28 16:08:35 +00:00
< link rel = "home" href = "../../../../index.html" title = "Chapter 1. Range 2.0" >
2010-04-28 16:09:03 +00:00
< link rel = "up" href = "../numeric.html" title = "Numeric algorithms" >
< link rel = "prev" href = "../numeric.html" title = "Numeric algorithms" >
2010-03-28 16:08:35 +00:00
< link rel = "next" href = "adjacent_difference.html" title = "adjacent_difference" >
< / head >
< body bgcolor = "white" text = "black" link = "#0000FF" vlink = "#840084" alink = "#0000FF" >
< table cellpadding = "2" width = "100%" > < tr >
< td valign = "top" > < img alt = "Boost C++ Libraries" width = "277" height = "86" src = "../../../../../../../../boost.png" > < / td >
< td align = "center" > < a href = "../../../../../../../../index.html" > Home< / a > < / td >
2010-07-13 20:31:40 +00:00
< td align = "center" > < a href = "../../../../../../../../libs/libraries.htm" > Libraries< / a > < / td >
2010-03-28 16:08:35 +00:00
< td align = "center" > < a href = "http://www.boost.org/users/people.html" > People< / a > < / td >
< td align = "center" > < a href = "http://www.boost.org/users/faq.html" > FAQ< / a > < / td >
< td align = "center" > < a href = "../../../../../../../../more/index.htm" > More< / a > < / td >
< / tr > < / table >
< hr >
< div class = "spirit-nav" >
2010-07-13 20:31:40 +00:00
< a accesskey = "p" href = "../numeric.html" > < img src = "../../../../../../../../doc/src/images/prev.png" alt = "Prev" > < / a > < a accesskey = "u" href = "../numeric.html" > < img src = "../../../../../../../../doc/src/images/up.png" alt = "Up" > < / a > < a accesskey = "h" href = "../../../../index.html" > < img src = "../../../../../../../../doc/src/images/home.png" alt = "Home" > < / a > < a accesskey = "n" href = "adjacent_difference.html" > < img src = "../../../../../../../../doc/src/images/next.png" alt = "Next" > < / a >
2010-03-28 16:08:35 +00:00
< / div >
2010-07-13 20:31:40 +00:00
< div class = "section" >
2010-03-28 16:08:35 +00:00
< div class = "titlepage" > < div > < div > < h5 class = "title" >
2010-04-28 16:09:03 +00:00
< a name = "range.reference.algorithms.numeric.accumulate" > < / a > < a class = "link" href = "accumulate.html" title = "accumulate" > accumulate< / a >
2010-03-28 16:08:35 +00:00
< / h5 > < / div > < / div > < / div >
2010-04-28 16:09:03 +00:00
< a name = "range.reference.algorithms.numeric.accumulate.prototype" > < / a > < h6 >
2010-07-13 20:31:40 +00:00
< a name = "id3134356" > < / a >
2010-04-28 16:09:03 +00:00
< a class = "link" href = "accumulate.html#range.reference.algorithms.numeric.accumulate.prototype" > Prototype< / a >
2010-03-28 16:08:35 +00:00
< / h6 >
< p >
< / p >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span >
< span class = "keyword" > class< / span > < span class = "identifier" > SinglePassRange< / span > < span class = "special" > ,< / span >
< span class = "keyword" > class< / span > < span class = "identifier" > Value< / span >
< span class = "special" > > < / span >
< span class = "identifier" > Value< / span > < span class = "identifier" > accumulate< / span > < span class = "special" > (< / span > < span class = "keyword" > const< / span > < span class = "identifier" > SinglePassRange< / span > < span class = "special" > & < / span > < span class = "identifier" > source_rng< / span > < span class = "special" > ,< / span >
< span class = "identifier" > Value< / span > < span class = "identifier" > init< / span > < span class = "special" > );< / span >
< span class = "keyword" > template< / span > < span class = "special" > < < / span >
< span class = "keyword" > class< / span > < span class = "identifier" > SinglePassRange< / span > < span class = "special" > ,< / span >
< span class = "keyword" > class< / span > < span class = "identifier" > Value< / span > < span class = "special" > ,< / span >
< span class = "keyword" > class< / span > < span class = "identifier" > BinaryOperation< / span >
< span class = "special" > > < / span >
< span class = "identifier" > Value< / span > < span class = "identifier" > accumulate< / span > < span class = "special" > (< / span > < span class = "keyword" > const< / span > < span class = "identifier" > SinglePassRange< / span > < span class = "special" > & < / span > < span class = "identifier" > source_rng< / span > < span class = "special" > ,< / span >
< span class = "identifier" > Value< / span > < span class = "identifier" > init< / span > < span class = "special" > ,< / span >
< span class = "identifier" > BinaryOperation< / span > < span class = "identifier" > op< / span > < span class = "special" > );< / span >
< / pre >
< p >
< / p >
2010-04-28 16:09:03 +00:00
< a name = "range.reference.algorithms.numeric.accumulate.description" > < / a > < h6 >
2010-07-13 20:31:40 +00:00
< a name = "id3134621" > < / a >
2010-04-28 16:09:03 +00:00
< a class = "link" href = "accumulate.html#range.reference.algorithms.numeric.accumulate.description" > Description< / a >
2010-03-28 16:08:35 +00:00
< / h6 >
< p >
< code class = "computeroutput" > < span class = "identifier" > accumulate< / span > < / code > is a generalisation
of summation. It computes a binary operation (< code class = "computeroutput" > < span class = "keyword" > operator< / span > < span class = "special" > +< / span > < / code > in the non-predicate version) of < code class = "computeroutput" > < span class = "identifier" > init< / span > < / code > and all of the elements in < code class = "computeroutput" > < span class = "identifier" > rng< / span > < / code > .
< / p >
< p >
The return value is the resultant value of the above algorithm.
< / p >
2010-04-28 16:09:03 +00:00
< a name = "range.reference.algorithms.numeric.accumulate.definition" > < / a > < h6 >
2010-07-13 20:31:40 +00:00
< a name = "id3134701" > < / a >
2010-04-28 16:09:03 +00:00
< a class = "link" href = "accumulate.html#range.reference.algorithms.numeric.accumulate.definition" > Definition< / a >
2010-03-28 16:08:35 +00:00
< / h6 >
< p >
Defined in the header file < code class = "computeroutput" > < span class = "identifier" > boost< / span > < span class = "special" > /< / span > < span class = "identifier" > range< / span > < span class = "special" > /< / span > < span class = "identifier" > numeric< / span > < span class = "special" > .< / span > < span class = "identifier" > hpp< / span > < / code >
< / p >
2010-04-28 16:09:03 +00:00
< a name = "range.reference.algorithms.numeric.accumulate.requirements" > < / a > < h6 >
2010-07-13 20:31:40 +00:00
< a name = "id3134765" > < / a >
2010-04-28 16:09:03 +00:00
< a class = "link" href = "accumulate.html#range.reference.algorithms.numeric.accumulate.requirements" > Requirements< / a >
2010-03-28 16:08:35 +00:00
< / h6 >
2010-04-28 16:09:03 +00:00
< a name = "range.reference.algorithms.numeric.accumulate.for_the_first_version" > < / a > < h6 >
2010-07-13 20:31:40 +00:00
< a name = "id3134789" > < / a >
2010-04-28 16:09:03 +00:00
< a class = "link" href = "accumulate.html#range.reference.algorithms.numeric.accumulate.for_the_first_version" > For
2010-03-28 16:08:35 +00:00
the first version< / a >
< / h6 >
< div class = "orderedlist" > < ol class = "orderedlist" type = "1" >
< li class = "listitem" >
2010-07-13 20:31:40 +00:00
< code class = "computeroutput" > < span class = "identifier" > SinglePassRange< / span > < / code > is
a model of the < a class = "link" href = "../../../concepts/single_pass_range.html" title = "Single Pass Range" > Single
Pass Range< / a > Concept.
< / li >
2010-03-28 16:08:35 +00:00
< li class = "listitem" >
2010-07-13 20:31:40 +00:00
< code class = "computeroutput" > < span class = "identifier" > Value< / span > < / code > is a model
of the < code class = "computeroutput" > < span class = "identifier" > AssignableConcept< / span > < / code > .
< / li >
2010-03-28 16:08:35 +00:00
< li class = "listitem" >
2010-07-13 20:31:40 +00:00
An < code class = "computeroutput" > < span class = "keyword" > operator< / span > < span class = "special" > +< / span > < / code >
is defined for a left-hand operand of type < code class = "computeroutput" > < span class = "identifier" > Value< / span > < / code >
and a right-hand operance of the < code class = "computeroutput" > < span class = "identifier" > SinglePassRange< / span > < / code >
value type.
< / li >
2010-03-28 16:08:35 +00:00
< li class = "listitem" >
2010-07-13 20:31:40 +00:00
The return type of the above operator is convertible to < code class = "computeroutput" > < span class = "identifier" > Value< / span > < / code > .
< / li >
2010-03-28 16:08:35 +00:00
< / ol > < / div >
2010-04-28 16:09:03 +00:00
< a name = "range.reference.algorithms.numeric.accumulate.for_the_second_version" > < / a > < h6 >
2010-07-13 20:31:40 +00:00
< a name = "id3134939" > < / a >
2010-04-28 16:09:03 +00:00
< a class = "link" href = "accumulate.html#range.reference.algorithms.numeric.accumulate.for_the_second_version" > For
2010-03-28 16:08:35 +00:00
the second version< / a >
< / h6 >
< div class = "orderedlist" > < ol class = "orderedlist" type = "1" >
< li class = "listitem" >
2010-07-13 20:31:40 +00:00
< code class = "computeroutput" > < span class = "identifier" > SinglePassRange< / span > < / code > is
a model of the < a class = "link" href = "../../../concepts/single_pass_range.html" title = "Single Pass Range" > Single
Pass Range< / a > Concept.
< / li >
2010-03-28 16:08:35 +00:00
< li class = "listitem" >
2010-07-13 20:31:40 +00:00
< code class = "computeroutput" > < span class = "identifier" > Value< / span > < / code > is a model
of the < code class = "computeroutput" > < span class = "identifier" > AssignableConcept< / span > < / code > .
< / li >
2010-03-28 16:08:35 +00:00
< li class = "listitem" >
2010-07-13 20:31:40 +00:00
< code class = "computeroutput" > < span class = "identifier" > BinaryOperation< / span > < / code > is
a model of the < code class = "computeroutput" > < span class = "identifier" > BinaryFunctionConcept< / span > < / code > .
< / li >
2010-03-28 16:08:35 +00:00
< li class = "listitem" >
2010-07-13 20:31:40 +00:00
< code class = "computeroutput" > < span class = "identifier" > Value< / span > < / code > is convertible
to < code class = "computeroutput" > < span class = "identifier" > BinaryOperation< / span > < / code > 's
first argument type.
< / li >
2010-03-28 16:08:35 +00:00
< li class = "listitem" >
2010-07-13 20:31:40 +00:00
< code class = "computeroutput" > < span class = "identifier" > SinglePassRange< / span > < / code > 's
value type is convertible to < code class = "computeroutput" > < span class = "identifier" > BinaryOperation< / span > < / code > 's
second argument type.
< / li >
2010-03-28 16:08:35 +00:00
< li class = "listitem" >
2010-07-13 20:31:40 +00:00
The return type of < code class = "computeroutput" > < span class = "identifier" > BinaryOperation< / span > < / code >
is convertible to < code class = "computeroutput" > < span class = "identifier" > Value< / span > < / code > .
< / li >
2010-03-28 16:08:35 +00:00
< / ol > < / div >
2010-04-28 16:09:03 +00:00
< a name = "range.reference.algorithms.numeric.accumulate.complexity" > < / a > < h6 >
2010-07-13 20:31:40 +00:00
< a name = "id3135142" > < / a >
2010-04-28 16:09:03 +00:00
< a class = "link" href = "accumulate.html#range.reference.algorithms.numeric.accumulate.complexity" > Complexity< / a >
2010-03-28 16:08:35 +00:00
< / h6 >
< p >
Linear. Exactly < code class = "computeroutput" > < span class = "identifier" > distance< / span > < span class = "special" > (< / span > < span class = "identifier" > source_rng< / span > < span class = "special" > )< / span > < / code > .
< / p >
< / div >
< table xmlns:rev = "http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width = "100%" > < tr >
< td align = "left" > < / td >
< td align = "right" > < div class = "copyright-footer" > Copyright © 2003 -2010 Thorsten Ottosen, Neil Groves< p >
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at < a href = "http://www.boost.org/LICENSE_1_0.txt" target = "_top" > http://www.boost.org/LICENSE_1_0.txt< / a > )
< / p >
< / div > < / td >
< / tr > < / table >
< hr >
< div class = "spirit-nav" >
2010-07-13 20:31:40 +00:00
< a accesskey = "p" href = "../numeric.html" > < img src = "../../../../../../../../doc/src/images/prev.png" alt = "Prev" > < / a > < a accesskey = "u" href = "../numeric.html" > < img src = "../../../../../../../../doc/src/images/up.png" alt = "Up" > < / a > < a accesskey = "h" href = "../../../../index.html" > < img src = "../../../../../../../../doc/src/images/home.png" alt = "Home" > < / a > < a accesskey = "n" href = "adjacent_difference.html" > < img src = "../../../../../../../../doc/src/images/next.png" alt = "Next" > < / a >
2010-03-28 16:08:35 +00:00
< / div >
< / body >
< / html >