-
Notifications
You must be signed in to change notification settings - Fork 5
Description
The current specification of std::execution::get_env() defines get_env(o) as as_const(o).get_env().
However, the as_const() function has a deleted rvalue-taking overload, meaning that you cannot pass temporaries to it.
This means that several uses of get_env() which pass expressions with are either potentially rvalues (e.g. in definition of connect(sndr, rcvr) it uses the expression get_env(rcvr), but rcvr could be, and usually is, a prvalue) or always rvalues (e.g. scheduler concept has the expression get_env(schedule(std::forward<Sch>(sch)))).
The intent here was that get_env() is a function that takes as an argument a const T& and thus allows prvalues to bind to it. We basically just want to require that get_env() finds a const-qualified member-function. The use of as_const() does not seem to mirror the semantics of a function with a const T& parameter, so I suggest we change it to something else.
Maybe an exposition-only AS-CONST(expr) that is equivalent to []<class T>(const T& x) noexcept -> const T& { return x; }(expr)?