Skip to content

Commit a9e6f8f

Browse files
committed
Additional LWG comments
1 parent d3d5ba7 commit a9e6f8f

File tree

3 files changed

+57
-42
lines changed

3 files changed

+57
-42
lines changed

algorithms.html

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ <h1>Effect of execution policies on algorithm execution</h1>
3333
</cxx-note>
3434
</p>
3535

36-
<cxx-example><pre>using namespace std::experimental::parallel<ins2>_v1</ins2>;
36+
<cxx-example><pre>using namespace std::experimental::parallel;
3737
int a[] = {0,1};
3838
std::vector&lt;int&gt; v;
3939
for_each(par, std::begin(a), std::end(a), [&amp;](int i) {
@@ -47,7 +47,7 @@ <h1>Effect of execution policies on algorithm execution</h1>
4747
</pre>
4848

4949
<cxx-example><pre>
50-
using namespace std::experimental::parallel<ins2>_v1</ins2>;
50+
using namespace std::experimental::parallel;
5151
std::atomic<ins2>&lt;int></ins2> x = 0;
5252
int a[] = {1,2};
5353
for_each(par, std::begin(a), std::end(a), [<ins2>&amp;</ins2>](int n) {
@@ -62,7 +62,7 @@ <h1>Effect of execution policies on algorithm execution</h1>
6262
</pre>
6363

6464
<cxx-example><pre>
65-
using namespace std::experimental::parallel<ins2>_v1</ins2>;
65+
using namespace std::experimental::parallel;
6666
int x<ins2>=0</ins2>;
6767
std::mutex m;
6868
int a[] = {1,2};
@@ -82,7 +82,7 @@ <h1>Effect of execution policies on algorithm execution</h1>
8282
in unspecified threads, and unsequenced within each thread.
8383
<ins2>
8484
<cxx-note>
85-
This means that multiple function-object invocations may be interleaved on a single thread.
85+
This means that multiple function object invocations may be interleaved on a single thread.
8686
</cxx-note>
8787
</ins2>
8888
<cxx-note>
@@ -120,8 +120,11 @@ <h1>Effect of execution policies on algorithm execution</h1>
120120
resources.
121121
</cxx-note>
122122

123+
<!-- TODO: LWG suggested removing it, I suspect this is a mistake based on the incorrect
124+
understanding that it is already covered elsewhere -->
125+
<del2>
123126
<p>
124-
<del2>If they exist, a</del2><ins2>A</ins2> parallel algorithm invoked with an execution policy object of type
127+
<ins2>A</ins2> parallel algorithm invoked with an execution policy object of type
125128
<code>parallel_execution_policy</code> or <code><del2>vector_execution_policy</del2><ins2>parallel_vector_execution_policy</ins2></code> may apply
126129
iterator member functions of a stronger category than its specification requires<ins2>, if such iterators exist</ins2>. In this
127130
case, the application of these member functions are subject to provisions 3. and 4. above,
@@ -134,6 +137,8 @@ <h1>Effect of execution policies on algorithm execution</h1>
134137
<code>operator[]</code>. In this case, it is the algorithm caller's responsibility to ensure
135138
<code>operator[]</code> is race-free.
136139
</cxx-note>
140+
</del2>
141+
<!-- end of potentially-incorrectly removed section -->
137142

138143
<p>
139144
Algorithms invoked with an execution policy object of type <code>execution_policy</code>
@@ -163,10 +168,13 @@ <h1><code>ExecutionPolicy</code> algorithm overloads</h1>
163168
<ins2>
164169
The Parallel Algorithms Library provides overloads for each of the algorithms named in
165170
Table 1, corresponding to the algorithms with the same name in the C++ Standard Algorithms Library.
166-
For each algorithm in <cxx-ref to="tab.parallel.algorithms"></cxx-ref>, there shall be overloads with an additional
167-
template type parameter named <code>ExecutionPolicy</code>, which is the first template parameter.
168-
In addition, each such overload shall have the new function parameter as the
169-
first function parameter of type <code>ExecutionPolicy&amp;&amp;</code>.
171+
172+
For each algorithm in <cxx-ref to="tab.parallel.algorithms"></cxx-ref>, if there are overloads for
173+
corresponding algorithms with the same name
174+
in the C++ Standard Algorithms Library,
175+
the overloads shall have an additional template type parameter named
176+
<code>ExecutionPolicy&amp;&amp;</code>, which shall be the first template parameter.
177+
170178
</ins2>
171179

172180
</p>
@@ -180,7 +188,7 @@ <h1><code>ExecutionPolicy</code> algorithm overloads</h1>
180188
Parallel algorithms
181189
<del>have the requirement <code>is_execution_policy&lt;ExecutionPolicy&gt;::value</code> is <code>true</code></del>
182190
<ins>shall not participate in overload resolution unless
183-
<code>is_execution_policy&lt;ExecutionPolicy&gt;::value</code> is <code>true</code></ins>.
191+
<code>is_execution_policy&lt;decay_t&lt;ExecutionPolicy&gt;&gt;::value</code> is <code>true</code></ins>.
184192
</p>
185193

186194
<del2><p>The algorithms listed in <cxx-ref to="tab.parallel.algorithms"></cxx-ref> shall have <code>ExecutionPolicy</code> overloads.</p></del2>
@@ -302,6 +310,10 @@ <h1><code>ExecutionPolicy</code> algorithm overloads</h1>
302310
<td></td>
303311
</tr>
304312
</table>
313+
314+
<cxx-note>
315+
Not all algorithms in the Standard Library have counterparts in <cxx-ref to="tab.parallel.algorithms"></cxx-ref>.
316+
</cxx-note>
305317
</cxx-section>
306318
</cxx-section>
307319

@@ -340,12 +352,10 @@ <h1>Definitions</h1>
340352
</p>
341353
</cxx-section>
342354

343-
<cxx-section id="parallel.alg.added">
344-
<h1>Novel algorithms</h1>
345-
346-
This subclause describes novel algorithms introduced by this Technical Specification.
355+
<cxx-section id="parallel.alg.ops">
356+
<h1>Non-Numeric Parallel Algorithms</h1>
347357

348-
<cxx-section id="parallel.alg.added.algorithms.synop">
358+
<cxx-section id="parallel.alg.ops.synopsis">
349359
<h1>Header <code>&lt;experimental/algorithm&gt;</code> synopsis</h1>
350360

351361
<pre>
@@ -368,7 +378,7 @@ <h1>Header <code>&lt;experimental/algorithm&gt;</code> synopsis</h1>
368378
</pre>
369379
</cxx-section>
370380

371-
<cxx-section id="parallel.alg.added.foreach">
381+
<cxx-section id="parallel.alg.foreach">
372382
<h1>For each</h1>
373383

374384
<cxx-function>
@@ -475,14 +485,18 @@ <h1>For each</h1>
475485

476486
<cxx-notes>
477487
Unlike its sequential form, the parallel overload of <code>for_each_n</code> requires
478-
<code>Function</code> to meet the requirements of <code>CopyConstructible</code>, but not
479-
<code>MoveConstructible</code>.
488+
<code>Function</code> to meet the requirements of <code>CopyConstructible</code><del2>, but not
489+
<code>MoveConstructible</code></del2>.
480490
</cxx-notes>
481491
</cxx-function>
482492
</ins>
483493
</cxx-section>
494+
</cxx-section>
495+
496+
<cxx-section id="parallel.alg.numeric">
497+
<h1>Numeric Parallel Algorithms</h1>
484498

485-
<cxx-section id="parallel.alg.added.numeric.synop">
499+
<cxx-section id="parallel.alg.numeric.synopsis">
486500
<h1>Header <code>&lt;experimental/numeric&gt;</code><ins2> synopsis</ins2></h1>
487501

488502
<pre>
@@ -539,7 +553,7 @@ <h1>Header <code>&lt;experimental/numeric&gt;</code><ins2> synopsis</ins2></h1>
539553
</pre>
540554
</cxx-section>
541555

542-
<cxx-section id="parallel.alg.added.reduce">
556+
<cxx-section id="parallel.alg.reduce">
543557
<h1>Reduce</h1>
544558

545559
<cxx-function>
@@ -627,7 +641,7 @@ <h1>Reduce</h1>
627641
</cxx-function>
628642
</cxx-section>
629643

630-
<cxx-section id="parallel.alg.added.exclusive.scan">
644+
<cxx-section id="parallel.alg.exclusive.scan">
631645
<h1>Exclusive scan</h1>
632646

633647
<cxx-function>
@@ -701,7 +715,7 @@ <h1>Exclusive scan</h1>
701715
</cxx-function>
702716
</cxx-section>
703717

704-
<cxx-section id="parallel.alg.added.inclusive.scan">
718+
<cxx-section id="parallel.alg.inclusive.scan">
705719
<h1>Inclusive scan</h1>
706720

707721
<cxx-function>

exceptions.html

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ <h1>Exception reporting behavior</h1>
5252
</ul>
5353
</p>
5454
</cxx-section>
55-
<cxx-section id="parallel.exceptions.synop">
55+
<cxx-section id="parallel.exceptions.synopsis">
5656
<h1>Header <code>&lt;experimental/exception_list&gt;</code> synopsis</h1>
5757
<pre>
5858

@@ -65,20 +65,21 @@ <h1>Header <code>&lt;experimental/exception_list&gt;</code> synopsis</h1>
6565
{
6666
public:
6767
<del2>
68-
typedef exception_ptr value_type;
69-
typedef const value_type&amp; reference;
70-
typedef const value_type&amp; const_reference;</del2>
71-
typedef <em>implementation-defined</em> const_iterator;
72-
typedef const_iterator iterator;
73-
typedef typename iterator_traits<ins2>&lt;const_iterator&gt;</ins2>::difference_type difference_type;
74-
<del2>
75-
typedef size_t size_type;</del2>
68+
typedef exception_ptr value_type;
69+
typedef const value_type&amp; reference;
70+
typedef const value_type&amp; const_reference;
71+
typedef <em>implementation-defined</em> const_iterator;
72+
typedef const_iterator iterator;
73+
typedef typename iterator_traits<ins2>&lt;const_iterator&gt;</ins2>::difference_type difference_type;
74+
typedef size_t size_type;</del2>
75+
<ins2>
76+
typedef <em>unspecified</em> iterator;</ins2>
7677

77-
<del2>size_t</del2><ins2>difference_type</ins2> size() const noexcept;
78+
size_t size() const noexcept;
7879
iterator begin() const noexcept;
7980
iterator end() const noexcept;
8081

81-
<ins2>const char* what() const noexcept</ins2>
82+
<ins2>const char* what() const override noexcept;</ins2>
8283
<del2>
8384
private:
8485
std::list&lt;exception_ptr&gt; exceptions_; // exposition only
@@ -97,7 +98,7 @@ <h1>Header <code>&lt;experimental/exception_list&gt;</code> synopsis</h1>
9798
</p>
9899

99100
<p>
100-
The type <code>exception_list::const_iterator</code> shall fulfill the requirements of
101+
The type <code>exception_list::iterator</code> shall fulfill the requirements of
101102
<code>ForwardIterator</code>.
102103
</p>
103104

execution_policies.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<h1>Execution policies</h1>
33
<cxx-section id="parallel.execpol.general">
44
<h1>In general</h1>
5-
<p>This subclause describes classes that represent <dfn>execution policies</dfn>. An
5+
<p>This clause describes classes that represent <dfn>execution policies</dfn>. An
66
<dfn>execution policy</dfn> is an object that expresses the requirements on the ordering
77
of functions invoked as a consequence of the invocation of a standard
88
algorithm. Execution policies afford standard algorithms the discretion to
@@ -36,7 +36,7 @@ <h1>In general</h1>
3636
// sort with dynamically-selected execution
3737
size_t threshold = ...
3838
execution_policy exec = seq;
39-
if(v.size() &gt; threshold)
39+
if (v.size() &gt; threshold)
4040
{
4141
exec = par;
4242
}
@@ -54,7 +54,7 @@ <h1>In general</h1>
5454
Technical Specification as extensions.
5555
</cxx-note>
5656
</cxx-section>
57-
<cxx-section id="parallel.execpol.synop">
57+
<cxx-section id="parallel.execpol.synopsis">
5858
<h1>Header <code>&lt;experimental/execution_policy&gt;</code> synopsis</h1>
5959

6060
<pre>
@@ -197,13 +197,13 @@ <h1>Dynamic execution policy</h1>
197197
</del2>
198198
</pre>
199199

200-
<p>The class <code>execution_policy</code> is a dynamic container for execution policy objects.
200+
<p>The class <code>execution_policy</code> is a container for execution policy objects.
201201
<code>execution_policy</code> allows dynamic control over standard algorithm execution.</p>
202202

203203
<cxx-example>
204204
<pre>std::vector&lt;float&gt; sort_me = ...
205205

206-
<ins>using namespace std::experimental::parallel<ins2>_v1</ins2>;</ins>
206+
<ins>using namespace std::experimental::parallel;</ins>
207207
<del><code>std::</code></del>execution_policy exec = <del><code>std::</code></del>seq;
208208

209209
if(sort_me.size() &gt; threshold)
@@ -310,9 +310,9 @@ <h1>Execution policy objects</h1>
310310
constexpr vector_execution_policy vec = vector_execution_policy();
311311
</del2>
312312
<ins2>
313-
constexpr sequential_execution_policy seq = {};
314-
constexpr parallel_execution_policy par = {};
315-
constexpr parallel_vector_execution_policy par_vec = {};
313+
constexpr sequential_execution_policy seq{};
314+
constexpr parallel_execution_policy par{};
315+
constexpr parallel_vector_execution_policy par_vec{};
316316
</ins2>
317317
<del2>
318318
}

0 commit comments

Comments
 (0)