You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<spanclass='keyword'>constexpr</span> T accumulate<spanclass='parenthesis'>(</span>InputIterator first, InputIterator last, T init<spanclass='parenthesis'>)</span>;
the <ahref='utility.arg.requirements#:Cpp17CopyConstructible' title='16.4.4.2 Template argument requirements [utility.arg.requirements]'><i>Cpp17CopyConstructible</i></a> (<ahref='utility.arg.requirements#tab:cpp17.copyconstructible' title='Table 32: Cpp17CopyConstructible requirements (in addition to Cpp17MoveConstructible)'>Table 32</a>)
8
+
and <ahref='utility.arg.requirements#:Cpp17CopyAssignable' title='16.4.4.2 Template argument requirements [utility.arg.requirements]'><i>Cpp17CopyAssignable</i></a> (<ahref='utility.arg.requirements#tab:cpp17.copyassignable' title='Table 34: Cpp17CopyAssignable requirements (in addition to Cpp17MoveAssignable)'>Table 34</a>) requirements<aclass='hidden_link' href='#1.sentence-1'>.</a></div><divid='1.sentence-2' class='sentence'>In the range [<spanclass='texttt'>first, last</span>],
9
+
<spanclass='texttt'>binary_<spanclass='shy'></span>op</span> neither modifies elements
10
+
nor invalidates iterators or subranges<aclass='hidden_link' href='#1.sentence-2'>.</a><ahref='#footnote-185' id='footnoteref-185' title='The use of fully closed ranges is intentional.'>¹⁸⁵</a></div></div></div></div><divclass='para' id='2'><divclass='marginalizedparent'><aclass='marginalized' href='#2'>2</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink' href='https://github.com/cplusplus/draft/tree/8ab1a9b574d97fea3809a2885c7f41f5d60b93f6/source/algorithms.tex#L12341'>#</a></div><divclass='texpara'><divid='2.sentence-1' class='sentence'><i>Effects</i>: Computes its result by
11
+
initializing the accumulator <spanclass='texttt'>acc</span> with the initial value <spanclass='texttt'>init</span>
12
+
and then modifies it with
13
+
<spanclass='texttt'>acc <spanclass='operator'>=</span> std<spanclass='operator'>​::​</span>move<spanclass='parenthesis'>(</span>acc<spanclass='parenthesis'>)</span><spanclass='operator'>+</span><spanclass='operator'>*</span>i</span> or
for every iterator <spanclass='texttt'>i</span> in the range [<spanclass='texttt'>first, last</span>) in order<aclass='hidden_link' href='#2.sentence-1'>.</a><ahref='#footnote-186' id='footnoteref-186' title='accumulate is similar to the APL reduction operator and Common Lisp reduce function, but it avoids the difficulty of defining the result of reduction on an empty sequence by always requiring an initial value.'>¹⁸⁶</a></div></div></div></div><divclass='footnoteSeparator'></div><divclass='footnote' id='footnote-185'><divclass='texpara'><aclass='footnotenum' href='#footnote-185'>185)</a><aclass='footnoteBacklink' href='#footnoteref-185'>185)</a><divid='footnote-185.sentence-1' class='sentence'>The use of fully closed ranges is intentional<aclass='hidden_link' href='#footnote-185.sentence-1'>.</a></div></div></div><divclass='footnote' id='footnote-186'><divclass='texpara'><aclass='footnotenum' href='#footnote-186'>186)</a><aclass='footnoteBacklink' href='#footnoteref-186'>186)</a><divid='footnote-186.sentence-1' class='sentence'><spanclass='texttt'>accumulate</span> is similar
16
+
to the APL reduction operator and Common Lisp reduce function,
17
+
but it avoids the difficulty of defining the result of reduction
18
+
on an empty sequence by always requiring an initial value<aclass='hidden_link' href='#footnote-186.sentence-1'>.</a></div></div></div></div></body></html>
0 commit comments