Skip to content

Commit ca1cc6d

Browse files
committed
Apply N4063
1 parent d9a8cd8 commit ca1cc6d

File tree

6 files changed

+167
-40
lines changed

6 files changed

+167
-40
lines changed

algorithms.html

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,35 @@ <h1>In general</h1>
77
This clause describes components that C++ programs may use to perform operations on containers
88
and other sequences in parallel.
99

10+
<cxx-section id="parallel.alg.general.user">
11+
<h1>Requirements on user-provided function objects</h1>
12+
<p>
13+
<ins>Function objects passed into parallel algorithms as objects of type <code>BinaryPredicate</code>,
14+
<code>Compare</code>, and <code>BinaryOperation</code> shall not directly or indirectly modify
15+
objects via their arguments.</ins>
16+
</p>
17+
</cxx-section>
18+
1019
<cxx-section id="parallel.alg.general.exec">
1120
<h1>Effect of execution policies on algorithm execution</h1>
1221

1322
<p>
1423
Parallel algorithms have template parameters named <code>ExecutionPolicy</code> which describe
1524
the manner in which the execution of these algorithms may be parallelized and the manner in
16-
which they apply user-provided function objects.
25+
which they apply <del>user-provided function objects</del><ins>the element access functions</ins>.
1726
</p>
1827

1928
<p>
20-
The applications of function objects in parallel algorithms invoked with an execution policy
21-
object of type <code>sequential_execution_policy</code> execute in sequential order in the
22-
calling thread.
29+
The <del>applications of function objects</del><ins>invocations of element access functions</ins>
30+
in parallel algorithms invoked with an execution policy object of type
31+
<code>sequential_execution_policy</code> execute in sequential order in the calling thread.
2332
</p>
2433

2534
<p>
26-
The applications of function objects in parallel algorithms invoked with an execution policy
27-
object of type <code>parallel_execution_policy</code> are permitted to execute in an unordered
28-
fashion in unspecified threads, and indeterminately sequenced within each thread.
35+
The <del>applications of function objects</del><ins>invocations of element access functions</ins>
36+
in parallel algorithms invoked with an execution policy object of type
37+
<code>parallel_execution_policy</code> are permitted to execute in an unordered fashion in
38+
unspecified threads, and indeterminately sequenced within each thread.
2939

3040
<cxx-note>
3141
It is the caller's responsibility to ensure correctness, for example that the invocation does
@@ -76,8 +86,9 @@ <h1>Effect of execution policies on algorithm execution</h1>
7686
</cxx-example>
7787

7888
<p>
79-
The applications of function objects in parallel algorithms invoked with an execution policy
80-
of type <code>parallel_vector_execution_policy</code> are permitted to execute in an unordered fashion
89+
The <del>applications of function objects</del><ins>invocations of element access functions</ins>
90+
in parallel algorithms invoked with an execution policy of type
91+
<code>parallel_vector_execution_policy</code> are permitted to execute in an unordered fashion
8192
in unspecified threads, and unsequenced <ins>with respect to one another</ins> within each thread.
8293

8394
<cxx-note>

exceptions.html

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ <h1>Exception reporting behavior</h1>
88
the algorithm throws a <code>std::bad_alloc</code> exception.
99
</p>
1010
<p>
11-
During the execution of a standard parallel algorithm, if the application of a function
12-
object terminates with an uncaught exception, the behavior of the program is determined
13-
by the type of execution policy used to invoke the algorithm:
11+
During the execution of a standard parallel algorithm, if the <del>application of a function
12+
object</del><ins>invocation of an element access function</ins> terminates with an uncaught
13+
exception, the behavior of the program is determined by the type of execution policy used to
14+
invoke the algorithm:
1415

1516
<ul>
1617
<li>
@@ -21,8 +22,8 @@ <h1>Exception reporting behavior</h1>
2122
If the execution policy object is of type <code>sequential_execution_policy</code> or
2223
<code>parallel_execution_policy</code>, the execution of the algorithm terminates with an
2324
<code>exception_list</code> exception. All uncaught exceptions thrown during
24-
the application of user-provided function objects shall be contained in the
25-
<code>exception_list</code>.<pre>
25+
the <del>application of user-provided function objects</del><ins>invocations of element access functions</ins>
26+
shall be contained in the <code>exception_list</code>.<pre>
2627
</pre>
2728

2829
<cxx-note>

execution_policies.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22
<h1>Execution policies</h1>
33
<cxx-section id="parallel.execpol.general">
44
<h1>In general</h1>
5-
<p>This clause describes classes that represent <dfn>execution policies</dfn>. An
5+
<p>
6+
<del>This clause describes classes that represent <dfn>execution policies</dfn>. An
67
<dfn>execution policy</dfn> is an object that expresses the requirements on the ordering
78
of functions invoked as a consequence of the invocation of a standard
89
algorithm. Execution policies afford standard algorithms the discretion to
9-
execute in parallel.</p>
10+
execute in parallel.</del>
11+
<ins>This clause describes classes that are <dfn>execution policy</dfn> types. An object
12+
of an execution policy type indicates to an algorithm whether it is allowed to execute
13+
in parallel and expresses the requirements on the element access functions.</ins>
14+
</p>
1015

1116
<cxx-example>
1217
<pre>std::vector&lt;int&gt; v = ...

general.html

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,51 @@ <h1>Namespaces and headers</h1>
7171
<code> #include &lt;meow&gt;</code>
7272
</pre>
7373

74-
<cxx-section id="parallel.general.defns">
74+
<cxx-section id="parallel.general.defns">
7575
<h1>Terms and definitions</h1>
7676

7777
<p>For the purposes of this document, the terms and definitions given in the C++ Standard and the following apply.</p>
7878

7979
<p>A <dfn>parallel algorithm</dfn> is a function template described by this Technical Specification declared in namespace <code>std::experimental::parallel::v1</code> with a formal template parameter named <code>ExecutionPolicy</code>.</p>
80+
81+
<p>
82+
<ins>Parallel algorithms access objects indirectly accessible via their arguments by invoking the following functions:</ins>
83+
84+
<ul>
85+
<li>
86+
<ins>All operations of the categories of the iterators that the algorithm is instantiated with.</ins>
87+
</li>
88+
89+
<li>
90+
<ins>Functions on those sequence elements that are required by its specification.</ins>
91+
</li>
92+
93+
<li>
94+
<ins>User-provided function objects to be applied during the execution of the algorithm, if required by the specification.</ins>
95+
</li>
96+
</ul>
97+
98+
<ins>These functions are herein called <em>element access functions</em>.</ins><pre>
99+
</pre>
100+
101+
<cxx-example>
102+
<ins>The <code>sort</code> function may invoke the following element access functions:</ins>
103+
104+
<ul>
105+
<li>
106+
<ins>Methods of the random-access iterator of the actual template argument, as per 24.2.7, as implied by the name of the
107+
template parameters <code>RandomAccessIterator</code>.</ins>
108+
</li>
109+
110+
<li>
111+
<ins>The <code>swap</code> function on the elements of the sequence (as per 25.4.1.1 [sort]/2).</ins>
112+
</li>
113+
114+
<li>
115+
<ins>The user-provided <code>Compare</code> function object.</ins>
116+
</li>
117+
</ul>
118+
</cxx-example>
119+
</p>
80120
</cxx-section>
81121
</cxx-clause>
82-

parallelism-ts.html

Lines changed: 93 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -687,11 +687,15 @@ <h1>Contents</h1>
687687

688688
<ol>
689689

690-
<li><span class="marker">4.1.1</span><a href="#parallel.alg.general.exec">Effect of execution policies on algorithm execution</a>
690+
<li><span class="marker">4.1.1</span><a href="#parallel.alg.general.user">Requirements on user-provided function objects</a>
691691

692692
</li>
693693

694-
<li><span class="marker">4.1.2</span><a href="#parallel.alg.overloads">ExecutionPolicy algorithm overloads</a>
694+
<li><span class="marker">4.1.2</span><a href="#parallel.alg.general.exec">Effect of execution policies on algorithm execution</a>
695+
696+
</li>
697+
698+
<li><span class="marker">4.1.3</span><a href="#parallel.alg.overloads">ExecutionPolicy algorithm overloads</a>
695699

696700
</li>
697701

@@ -855,7 +859,7 @@ <h1>Contents</h1>
855859
<pre><code> #include &lt;meow&gt;</code>
856860
</pre>
857861

858-
<cxx-section id="parallel.general.defns">
862+
<cxx-section id="parallel.general.defns">
859863

860864

861865
<section>
@@ -866,6 +870,50 @@ <h1>Contents</h1>
866870
<p para_num="1" id="parallel.general.defns.1">For the purposes of this document, the terms and definitions given in the C++ Standard and the following apply.</p>
867871

868872
<p para_num="2" id="parallel.general.defns.2">A <dfn>parallel algorithm</dfn> is a function template described by this Technical Specification declared in namespace <code>std::experimental::parallel::v1</code> with a formal template parameter named <code>ExecutionPolicy</code>.</p>
873+
874+
<p para_num="3" id="parallel.general.defns.3">
875+
<ins>Parallel algorithms access objects indirectly accessible via their arguments by invoking the following functions:</ins>
876+
877+
</p><ul>
878+
<li>
879+
<ins>All operations of the categories of the iterators that the algorithm is instantiated with.</ins>
880+
</li>
881+
882+
<li>
883+
<ins>Functions on those sequence elements that are required by its specification.</ins>
884+
</li>
885+
886+
<li>
887+
<ins>User-provided function objects to be applied during the execution of the algorithm, if required by the specification.</ins>
888+
</li>
889+
</ul>
890+
891+
<ins>These functions are herein called <em>element access functions</em>.</ins><pre></pre>
892+
893+
<cxx-example>
894+
895+
<span class="nowrap">[ <em>Example:</em></span>
896+
897+
<ins>The <code>sort</code> function may invoke the following element access functions:</ins>
898+
899+
<ul>
900+
<li>
901+
<ins>Methods of the random-access iterator of the actual template argument, as per 24.2.7, as implied by the name of the
902+
template parameters <code>RandomAccessIterator</code>.</ins>
903+
</li>
904+
905+
<li>
906+
<ins>The <code>swap</code> function on the elements of the sequence (as per 25.4.1.1 [sort]/2).</ins>
907+
</li>
908+
909+
<li>
910+
<ins>The user-provided <code>Compare</code> function object.</ins>
911+
</li>
912+
</ul>
913+
914+
<span class="nowrap"><em>end example</em> ]</span>
915+
</cxx-example>
916+
<p para_num="4" id="parallel.general.defns.4"></p>
869917

870918
</section>
871919
</cxx-section>
@@ -875,7 +923,6 @@ <h1>Contents</h1>
875923
</section>
876924
</cxx-clause>
877925

878-
879926
<cxx-clause id="parallel.execpol">
880927

881928

@@ -890,11 +937,16 @@ <h1>Contents</h1>
890937
<header><span class="section-number">2.1</span> <h1 data-bookmark-label="2.1 In general">In general</h1> <span style="float:right"><a href="#parallel.execpol.general">[parallel.execpol.general]</a></span></header>
891938

892939

893-
<p para_num="1" id="parallel.execpol.general.1">This clause describes classes that represent <dfn>execution policies</dfn>. An
940+
<p para_num="1" id="parallel.execpol.general.1">
941+
<del>This clause describes classes that represent <dfn>execution policies</dfn>. An
894942
<dfn>execution policy</dfn> is an object that expresses the requirements on the ordering
895943
of functions invoked as a consequence of the invocation of a standard
896944
algorithm. Execution policies afford standard algorithms the discretion to
897-
execute in parallel.</p>
945+
execute in parallel.</del>
946+
<ins>This clause describes classes that are <dfn>execution policy</dfn> types. An object
947+
of an execution policy type indicates to an algorithm whether it is allowed to execute
948+
in parallel and expresses the requirements on the element access functions.</ins>
949+
</p>
898950

899951
<cxx-example>
900952

@@ -1260,9 +1312,10 @@ <h1>Contents</h1>
12601312
the algorithm throws a <code>std::bad_alloc</code> exception.
12611313
</p>
12621314
<p para_num="2" id="parallel.exceptions.behavior.2">
1263-
During the execution of a standard parallel algorithm, if the application of a function
1264-
object terminates with an uncaught exception, the behavior of the program is determined
1265-
by the type of execution policy used to invoke the algorithm:
1315+
During the execution of a standard parallel algorithm, if the <del>application of a function
1316+
object</del><ins>invocation of an element access function</ins> terminates with an uncaught
1317+
exception, the behavior of the program is determined by the type of execution policy used to
1318+
invoke the algorithm:
12661319

12671320
</p><ul>
12681321
<li>
@@ -1273,8 +1326,8 @@ <h1>Contents</h1>
12731326
If the execution policy object is of type <code>sequential_execution_policy</code> or
12741327
<code>parallel_execution_policy</code>, the execution of the algorithm terminates with an
12751328
<code>exception_list</code> exception. All uncaught exceptions thrown during
1276-
the application of user-provided function objects shall be contained in the
1277-
<code>exception_list</code>.<pre></pre>
1329+
the <del>application of user-provided function objects</del><ins>invocations of element access functions</ins>
1330+
shall be contained in the <code>exception_list</code>.<pre></pre>
12781331

12791332
<cxx-note><span class="nowrap">[ <em>Note:</em></span>
12801333

@@ -1470,30 +1523,47 @@ <h1>Contents</h1>
14701523
This clause describes components that C++ programs may use to perform operations on containers
14711524
and other sequences in parallel.
14721525

1526+
<cxx-section id="parallel.alg.general.user">
1527+
1528+
1529+
<section>
1530+
<header><span class="section-number">4.1.1</span> <h1 data-bookmark-label="4.1.1 Requirements on user-provided function objects">Requirements on user-provided function objects</h1> <span style="float:right"><a href="#parallel.alg.general.user">[parallel.alg.general.user]</a></span></header>
1531+
1532+
1533+
<p para_num="1" id="parallel.alg.general.user.1">
1534+
<ins>Function objects passed into parallel algorithms as objects of type <code>BinaryPredicate</code>,
1535+
<code>Compare</code>, and <code>BinaryOperation</code> shall not directly or indirectly modify
1536+
objects via their arguments.</ins>
1537+
</p>
1538+
1539+
</section>
1540+
</cxx-section>
1541+
14731542
<cxx-section id="parallel.alg.general.exec">
14741543

14751544

14761545
<section>
1477-
<header><span class="section-number">4.1.1</span> <h1 data-bookmark-label="4.1.1 Effect of execution policies on algorithm execution">Effect of execution policies on algorithm execution</h1> <span style="float:right"><a href="#parallel.alg.general.exec">[parallel.alg.general.exec]</a></span></header>
1546+
<header><span class="section-number">4.1.2</span> <h1 data-bookmark-label="4.1.2 Effect of execution policies on algorithm execution">Effect of execution policies on algorithm execution</h1> <span style="float:right"><a href="#parallel.alg.general.exec">[parallel.alg.general.exec]</a></span></header>
14781547

14791548

14801549

14811550
<p para_num="1" id="parallel.alg.general.exec.1">
14821551
Parallel algorithms have template parameters named <code>ExecutionPolicy</code> which describe
14831552
the manner in which the execution of these algorithms may be parallelized and the manner in
1484-
which they apply user-provided function objects.
1553+
which they apply <del>user-provided function objects</del><ins>the element access functions</ins>.
14851554
</p>
14861555

14871556
<p para_num="2" id="parallel.alg.general.exec.2">
1488-
The applications of function objects in parallel algorithms invoked with an execution policy
1489-
object of type <code>sequential_execution_policy</code> execute in sequential order in the
1490-
calling thread.
1557+
The <del>applications of function objects</del><ins>invocations of element access functions</ins>
1558+
in parallel algorithms invoked with an execution policy object of type
1559+
<code>sequential_execution_policy</code> execute in sequential order in the calling thread.
14911560
</p>
14921561

14931562
<p para_num="3" id="parallel.alg.general.exec.3">
1494-
The applications of function objects in parallel algorithms invoked with an execution policy
1495-
object of type <code>parallel_execution_policy</code> are permitted to execute in an unordered
1496-
fashion in unspecified threads, and indeterminately sequenced within each thread.
1563+
The <del>applications of function objects</del><ins>invocations of element access functions</ins>
1564+
in parallel algorithms invoked with an execution policy object of type
1565+
<code>parallel_execution_policy</code> are permitted to execute in an unordered fashion in
1566+
unspecified threads, and indeterminately sequenced within each thread.
14971567

14981568
<cxx-note><span class="nowrap">[ <em>Note:</em></span>
14991569

@@ -1558,8 +1628,9 @@ <h1>Contents</h1>
15581628
</cxx-example>
15591629

15601630
<p para_num="4" id="parallel.alg.general.exec.4">
1561-
The applications of function objects in parallel algorithms invoked with an execution policy
1562-
of type <code>parallel_vector_execution_policy</code> are permitted to execute in an unordered fashion
1631+
The <del>applications of function objects</del><ins>invocations of element access functions</ins>
1632+
in parallel algorithms invoked with an execution policy of type
1633+
<code>parallel_vector_execution_policy</code> are permitted to execute in an unordered fashion
15631634
in unspecified threads, and unsequenced <ins>with respect to one another</ins> within each thread.
15641635

15651636
<cxx-note><span class="nowrap">[ <em>Note:</em></span>
@@ -1663,7 +1734,7 @@ <h1>Contents</h1>
16631734

16641735

16651736
<section>
1666-
<header><span class="section-number">4.1.2</span> <h1 data-bookmark-label="4.1.2 ExecutionPolicy algorithm overloads"><code>ExecutionPolicy</code> algorithm overloads</h1> <span style="float:right"><a href="#parallel.alg.overloads">[parallel.alg.overloads]</a></span></header>
1737+
<header><span class="section-number">4.1.3</span> <h1 data-bookmark-label="4.1.3 ExecutionPolicy algorithm overloads"><code>ExecutionPolicy</code> algorithm overloads</h1> <span style="float:right"><a href="#parallel.alg.overloads">[parallel.alg.overloads]</a></span></header>
16671738

16681739

16691740

parallelism-ts.pdf

2.69 KB
Binary file not shown.

0 commit comments

Comments
 (0)