task::connect()Section: 33.13.6.2 [task.class] Status: New Submitter: Dietmar Kühl Opened: 2025-08-31 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:
Coroutines can't be copied. Thus, a task can be
connect() just once. To represent that
task::connect() should be rvalue reference qualified
but currently it isn't.
Proposed resolution:
In the synopsis in 33.13.6.2 [task.class] add rvalue
reference qualification to task::connect():
namespace std::execution {
template<class T, class Environment>
class task {
...
template<receiver Rcvr>
state<Rcvr> connect(Rcvr&& rcvr) &&;
...
}
}
In the specification in 33.13.6.3 [task.members] paragraph 3 add rvalue
reference qualification to task::connect():
template<receiver Rcvr> state<Rcvr> connect(Rcvr&& rcvr) &&;-3- Precondition:
bool(handle)istrue.-4- Effects: Equivalent to:
return state<Rcvr>(exchange(handle, {}), std::forward<Rcvr>(recv));