Title
Missing default template arguments for task
Status
new
Section
[task.class]
Submitter
Dietmar Kühl

Created on 2025-09-01.00:00:00 last changed 2 weeks ago

Messages

Date: 2025-09-01.20:23:52

Proposed resolution:

Add default template arguments for task for T = void and Environment = env<> in the synopsis of [task.class]:

namespace std::execution {
  template<class T = void, class Environment = env<>>
  class task {
     ...
  };
}

Date: 2025-09-01.00:00:00

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 [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.

History
Date User Action Args
2025-09-01 20:23:52adminsetmessages: + msg15002
2025-09-01 00:00:00admincreate