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
Section: 33.13.6.2 [task.class] Status: New Submitter: Dietmar Kühl Opened: 2025-09-01 Last modified: 2025-09-01
Priority: Not Prioritized
View other active issues in [task.class].
View all other issues in [task.class].
View all issues with New status.
Discussion:
The design discussion of task
describes defaults for
the two template parameters T
and Environment
of task
but these defaults are not reflected in the
synopsis of 33.13.6.2 [task.class].
This is an oversight and should be fixed. The default for
T
should be void
and the default for
Environment
should be env<>
(the
design paper used empty_env
but this struct
was replaced by the class template env
by P3325R5).
There could be a counter argument to defining a default for the
Environment
template parameter: this type is used to
determine various customizations of task
, e.g., the
allocator_type
, the scheduler_type
, and
the stop_source_type
. Leaving the type a required
argument means that a future standard could choose a possibly better
default than the types determined when the Environment
doesn't define them. On the other hand, a future standard could
provide a suitable alias with modified types under a different
name and/or a different namespace. Based on the LEWG discussion
on 2025-08-26 the direction is to add the default arguments.
Proposed resolution:
Add default template arguments for task
for
T = void
and Environment = env<>
in the synopsis of 33.13.6.2 [task.class]:
namespace std::execution { template<class T = void, class Environment = env<>> class task { ... }; }