Skip to content

Commit 265c7b8

Browse files
authored
New issue from Dietmar Kühl: Missing default template arguments for task
1 parent 6c06efb commit 265c7b8

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

xml/issue4343.xml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?xml version='1.0' encoding='utf-8' standalone='no'?>
2+
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3+
4+
<issue num="4343" status="New">
5+
<title>Missing default template arguments for <code>task</code></title>
6+
<section><sref ref="[task.class]"/></section>
7+
<submitter>Dietmar Kühl</submitter>
8+
<date>01 Sep 2025</date>
9+
<priority>99</priority>
10+
11+
<discussion>
12+
<p>
13+
The design discussion of <code>task</code> describes defaults for
14+
the two template parameters <code>T</code> and <code>Environment</code>
15+
of <code>task</code> but these defaults are not reflected in the
16+
synopsis of <sref ref="[task.class]"/>.
17+
This is an oversight and should be fixed. The default for
18+
<code>T</code> should be <code>void</code> and the default for
19+
<code>Environment</code> should be <code>env&lt;&gt;</code> (the
20+
design paper used <code>empty_env</code> but this <code>struct</code>
21+
was replaced by the class template <code>env</code> by <paper num="p3325r5"/>).
22+
</p>
23+
<p>
24+
There could be a counter argument to defining a default for the
25+
<code>Environment</code> template parameter: this type is used to
26+
determine various customizations of <code>task</code>, e.g., the
27+
<code>allocator_type</code>, the <code>scheduler_type</code>, and
28+
the <code>stop_source_type</code>. Leaving the type a required
29+
argument means that a future standard could choose a possibly better
30+
default than the types determined when the <code>Environment</code>
31+
doesn't define them. On the other hand, a future standard could
32+
provide a suitable alias with modified types under a different
33+
name and/or a different namespace. Based on the LEWG discussion
34+
on 2025-08-26 the direction is to add the default arguments.
35+
</p>
36+
</discussion>
37+
38+
<resolution>
39+
<p>
40+
Add default template arguments for <code>task</code> for
41+
<code>T = void</code> and <code>Environment = env&lt;&gt;</code>
42+
in the synopsis of <sref ref="[task.class]"/>:
43+
<blockquote><pre>
44+
namespace std::execution {
45+
template&lt;class T <ins>= void</ins>, class Environment <ins>= env&lt;&gt;</ins>&gt;
46+
class task {
47+
...
48+
};
49+
}
50+
</pre></blockquote>
51+
</p>
52+
</resolution>
53+
54+
</issue>

0 commit comments

Comments
 (0)