This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
task<...>::promise_type
supports arbitrary allocator_arg
positionSection: 33.13.6.5 [task.promise] Status: New Submitter: Dietmar Kühl Opened: 2025-08-31 Last modified: 2025-09-01
Priority: Not Prioritized
View other active issues in [task.promise].
View all other issues in [task.promise].
View all issues with New status.
Discussion:
Normally the allocator_arg
argument has to be the first
argument when present. For task<...>::promise_type
the allocator_arg
can appear at an arbitrary position
(except the last because it always needs to be followed by the
allocator). This permission is inconsistent and the position of the
allocator_arg
argument and the allocator should be
limited to come first.
For containers the optional support for allocators is implemented
once for every container. For coroutines the optional support for
allocators is implemented once for every coroutine definition. To
support an optional allocator the coroutine definition needs to use
an allocator and either gets duplicated not using an allocator or
a forwarding function is added which adds the default allocator.
With the flexible allocator position optional allocator support can be provided
using a trailing argument list, i.e., adding , auto&&...
.
Instead of constraining task
it may be more reasonable
to add the flexibility to generator
.
Proposed resolution: