Skip to content

Commit f65623d

Browse files
committed
New issue from Dietmar Kühl: Missing default template arguments for task
1 parent bb05060 commit f65623d

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

xml/issue4343.xml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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 <a href="https://wg21.link/task.class">[task.class]</a>.
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 <a
22+
href="https://wg21.link/p3325">P3325r5</a>).
23+
</p>
24+
<p>
25+
There could be a counter argument to defining a default for the
26+
<code>Environment</code> template parameter: this type is used to
27+
determine various customizations of <code>task</code>, e.g., the
28+
<code>allocator_type</code>, the <code>scheduler_type</code>, and
29+
the <code>stop_source_type</code>. Leaving the type a required
30+
argument means that a future standard could choose a possibly better
31+
default than the types determined when the <code>Environment</code>
32+
doesn't define them. On the other hand, a future standard could
33+
provide a suitable alias with modified types under a different
34+
name and/or a different namespace. Based on the LEWG discussion
35+
on 2025-08-26 the direction is to add the default arguments.
36+
</p>
37+
</discussion>
38+
39+
<resolution>
40+
<p>
41+
Add default template arguments for <code>task</code> for
42+
<code>T = void</code> and <code>Environment = env&lt;&gt;</code>
43+
in the synopsis of <a
44+
href="https://wg21.link/task.class">[task.class]</a>:
45+
<blockquote><pre>
46+
namespace std::execution {
47+
template&lt;class T <ins>= void</ins>, class Environment <ins>= env&lt;&gt;</ins>&gt;
48+
class task {
49+
...
50+
};
51+
}
52+
</pre></blockquote>
53+
</p>
54+
</resolution>
55+
56+
</issue>

0 commit comments

Comments
 (0)