Title
Missing rvalue reference qualification for task::connect()
Status
new
Section
[task.class]
Submitter
Dietmar Kühl

Created on 2025-08-31.00:00:00 last changed 2 weeks ago

Messages

Date: 2025-09-01.17:08:00

Proposed resolution:

In the synopsis in [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 [task.members] paragraph 3 add rvalue reference qualification to task::connect():

template<receiver Rcvr>
    state<Rcvr> connect(Rcvr&& rcvr) &&;

-3- Precondition: bool(handle) is true.

-4- Effects: Equivalent to:

    return state<Rcvr>(exchange(handle, {}), std::forward<Rcvr>(recv));

Date: 2025-08-31.00:00:00

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.

History
Date User Action Args
2025-09-01 17:08:00adminsetmessages: + msg14998
2025-08-31 00:00:00admincreate