Skip to content

Commit ac4e078

Browse files
authored
New issue from Dietmar Kühl: task<...>::promise_type supports arbitrary allocator_arg position
1 parent dd955c4 commit ac4e078

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

xml/issue4334.xml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version='1.0' encoding='utf-8' standalone='no'?>
2+
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3+
4+
<issue num="4334" status="New">
5+
<title><code>task&lt;...&gt;::promise_type</code> supports arbitrary <code>allocator_arg</code> position</title>
6+
<section><sref ref="[task.promise]"/></section>
7+
<submitter>Dietmar Kühl</submitter>
8+
<date>31 Aug 2025</date>
9+
<priority>99</priority>
10+
11+
<discussion>
12+
<p>
13+
Normally the <code>allocator_arg</code> argument has to be the first
14+
argument when present. For <code>task&lt;...&gt;::promise_type</code>
15+
the <code>allocator_arg</code> can appear at an arbitrary position
16+
(except the last because it always needs to be followed by the
17+
allocator). This permission is inconsistent and the position of the
18+
<code>allocator_arg</code> argument and the allocator should be
19+
limited to come first.
20+
</p>
21+
<p>
22+
For containers the optional support for allocators is implemented
23+
once for every container. For coroutines the optional support for
24+
allocators is implemented once for every coroutine definition. To
25+
support an optional allocator the coroutine definition needs to use
26+
an allocator and either gets duplicated not using an allocator or
27+
a forwarding function is added which adds the default allocator.
28+
With the flexible allocator position optional allocator support can be provided
29+
using a trailing argument list, i.e., adding <code>, auto&amp;&amp;...</code>.
30+
Instead of constraining <code>task</code> it may be more reasonable
31+
to add the flexibility to <code>generator</code>.
32+
</p>
33+
</discussion>
34+
35+
<resolution>
36+
<p>
37+
</p>
38+
</resolution>
39+
40+
</issue>

0 commit comments

Comments
 (0)