Skip to content

Commit 8e81bad

Browse files
committed
Add N5050
1 parent c1a99f5 commit 8e81bad

4,052 files changed

Lines changed: 573068 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

n5050/14882.css

Lines changed: 796 additions & 0 deletions
Large diffs are not rendered by default.

n5050/accumulate.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE html><html lang='en'><head><title>[accumulate]</title><meta charset='UTF-8'><link rel='stylesheet' type='text/css' href='14882.css'><link rel='stylesheet' type='text/css' href='https://fonts.googleapis.com/css2?family=Noto+Serif'><link rel='stylesheet' type='text/css' href='https://fonts.googleapis.com/css2?family=Noto+Sans'><link rel='stylesheet' type='text/css' href='https://fonts.googleapis.com/css2?family=Noto+Sans+Mono'><link rel='icon' href='icon-light.png' media='(prefers-color-scheme: light)'><link rel='icon' href='icon-dark.png' media='(prefers-color-scheme: dark)'><link rel='stylesheet' type='text/css' href='expanded.css' title='Normal'><link rel='alternate stylesheet' type='text/css' href='colored.css' title='Notes and examples colored'><link rel='alternate stylesheet' type='text/css' href='normative-only.css' title='Notes and examples hidden'></head><body><div class='wrapper'><h1 ><a class='secnum' style='min-width:50pt'>26</a> Algorithms library <a class='abbr_ref' href='./#algorithms'>[algorithms]</a></h1><h2 ><a class='secnum' style='min-width:65pt'>26.10</a> Generalized numeric operations <a class='abbr_ref' href='numeric.ops#accumulate'>[numeric.ops]</a></h2><h3 ><a class='secnum' style='min-width:80pt'>26.10.3</a> Accumulate <a class='abbr_ref'>[accumulate]</a></h3><div class='texpara'><div id='lib:accumulate'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:accumulate'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'>&lt;</span><span class='keyword'>class</span> InputIterator, <span class='keyword'>class</span> T<span class='anglebracket'>&gt;</span>
2+
<span class='keyword'>constexpr</span> T accumulate<span class='parenthesis'>(</span>InputIterator first, InputIterator last, T init<span class='parenthesis'>)</span>;
3+
<span class='keyword'>template</span><span class='anglebracket'>&lt;</span><span class='keyword'>class</span> InputIterator, <span class='keyword'>class</span> T, <span class='keyword'>class</span> BinaryOperation<span class='anglebracket'>&gt;</span>
4+
<span class='keyword'>constexpr</span> T accumulate<span class='parenthesis'>(</span>InputIterator first, InputIterator last, T init,
5+
BinaryOperation binary_op<span class='parenthesis'>)</span>;
6+
</code></div></div></div><div class='para' id='1'><div class='marginalizedparent'><a class='marginalized' href='#1'>1</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/cplusplus/draft/tree/8ab1a9b574d97fea3809a2885c7f41f5d60b93f6/source/algorithms.tex#L12329'>#</a></div><div class='texpara'><div id='1.sentence-1' class='sentence'><i >Preconditions</i>: <span class='texttt'>T</span> meets
7+
the <a href='utility.arg.requirements#:Cpp17CopyConstructible' title='16.4.4.2&emsp;Template argument requirements&emsp;[utility.arg.requirements]'><i >Cpp17CopyConstructible</i></a> (<a href='utility.arg.requirements#tab:cpp17.copyconstructible' title='Table 32: Cpp17CopyConstructible requirements (in addition to Cpp17MoveConstructible)'>Table 32</a>)
8+
and <a href='utility.arg.requirements#:Cpp17CopyAssignable' title='16.4.4.2&emsp;Template argument requirements&emsp;[utility.arg.requirements]'><i >Cpp17CopyAssignable</i></a> (<a href='utility.arg.requirements#tab:cpp17.copyassignable' title='Table 34: Cpp17CopyAssignable requirements (in addition to Cpp17MoveAssignable)'>Table 34</a>) requirements<a class='hidden_link' href='#1.sentence-1'>.</a></div> <div id='1.sentence-2' class='sentence'>In the range [<span class='texttt'>first, last</span>],
9+
<span class='texttt'>binary_<span class='shy'></span>op</span> neither modifies elements
10+
nor invalidates iterators or subranges<a class='hidden_link' href='#1.sentence-2'>.</a><a href='#footnote-185' id='footnoteref-185' title='The use of fully closed ranges is intentional.'>¹⁸⁵</a></div></div></div></div><div class='para' id='2'><div class='marginalizedparent'><a class='marginalized' href='#2'>2</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/cplusplus/draft/tree/8ab1a9b574d97fea3809a2885c7f41f5d60b93f6/source/algorithms.tex#L12341'>#</a></div><div class='texpara'><div id='2.sentence-1' class='sentence'><i >Effects</i>: Computes its result by
11+
initializing the accumulator <span class='texttt'>acc</span> with the initial value <span class='texttt'>init</span>
12+
and then modifies it with
13+
<span class='texttt'>acc <span class='operator'>=</span> std<span class='operator'>&#x200b;::&#x200b;</span>move<span class='parenthesis'>(</span>acc<span class='parenthesis'>)</span> <span class='operator'>+</span> <span class='operator'>*</span>i</span> or
14+
<span class='texttt'>acc <span class='operator'>=</span> binary_<span class='shy'></span>op<span class='parenthesis'>(</span>std<span class='operator'>&#x200b;::&#x200b;</span>move<span class='parenthesis'>(</span>acc<span class='parenthesis'>)</span>, <span class='operator'>*</span>i<span class='parenthesis'>)</span></span>
15+
for every iterator <span class='texttt'>i</span> in the range [<span class='texttt'>first, last</span>) in order<a class='hidden_link' href='#2.sentence-1'>.</a><a href='#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><div class='footnoteSeparator'></div><div class='footnote' id='footnote-185'><div class='texpara'><a class='footnotenum' href='#footnote-185'>185)</a><a class='footnoteBacklink' href='#footnoteref-185'>185)</a> <div id='footnote-185.sentence-1' class='sentence'>The use of fully closed ranges is intentional<a class='hidden_link' href='#footnote-185.sentence-1'>.</a></div></div></div><div class='footnote' id='footnote-186'><div class='texpara'><a class='footnotenum' href='#footnote-186'>186)</a><a class='footnoteBacklink' href='#footnoteref-186'>186)</a> <div id='footnote-186.sentence-1' class='sentence'><span class='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<a class='hidden_link' href='#footnote-186.sentence-1'>.</a></div></div></div></div></body></html>

0 commit comments

Comments
 (0)