Skip to content

Commit 05edf7d

Browse files
committed
Explicitly specify the parallel overload of for_each_n so that it does
not inherit sequential for_each_n's requirement of MoveConstructibility of Function. Fixes n3554/n3554#54
1 parent 1783cf9 commit 05edf7d

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

algorithms.html

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,9 +405,46 @@ <h1>For each</h1>
405405
</cxx-note>
406406
</cxx-effects>
407407

408+
<cxx-returns>
409+
<code>first + n</code>.
410+
</cxx-returns>
411+
412+
<cxx-remarks>
413+
If <code>f</code> returns a result, the result is ignored.
414+
</cxx-remarks>
415+
</cxx-function>
416+
417+
<cxx-function>
418+
<cxx-signature>
419+
template&lt;class ExecutionPolicy,
420+
class InputIterator, class Size, class Function&gt;
421+
InputIterator for_each_n(ExecutionPolicy &amp;&amp; exec,
422+
InputIterator first, Size n,
423+
Function f);
424+
</cxx-signature>
425+
426+
<cxx-effects>
427+
Applies <code>f</code> to the result of dereferencing every iterator in the range
428+
<code>[first,first + n)</code>, starting from <code>first</code> and proceeding to <code>first + n - 1</code>.
429+
430+
<cxx-note>
431+
If the type of <code>first</code> satisfies the requirements of a mutable iterator,
432+
<code>f</code> may apply nonconstant functions through the dereferenced iterator.
433+
</cxx-note>
434+
</cxx-effects>
435+
436+
<cxx-returns>
437+
<code>first + n</code>.
438+
</cxx-returns>
439+
408440
<cxx-remarks>
409441
If <code>f</code> returns a result, the result is ignored.
410442
</cxx-remarks>
443+
444+
<cxx-notes>
445+
Unlike its sequential form, the parallel overload of <code>for_each_n</code> does not require
446+
<code>Function</code> to meet the requirements of <code>MoveConstructible</code>.
447+
</cxx-notes>
411448
</cxx-function>
412449
</cxx-section>
413450

0 commit comments

Comments
 (0)