|
| 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<...>::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<...>::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&&...</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