get_env()
specified in terms of as_const()
but this doesn't work with rvalue senders
#296
Labels
get_env()
specified in terms of as_const()
but this doesn't work with rvalue senders
#296
The current specification of
std::execution::get_env()
definesget_env(o)
asas_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 ofconnect(sndr, rcvr)
it uses the expressionget_env(rcvr)
, butrcvr
could be, and usually is, a prvalue) or always rvalues (e.g.scheduler
concept has the expressionget_env(schedule(std::forward<Sch>(sch)))
).The intent here was that
get_env()
is a function that takes as an argument aconst T&
and thus allows prvalues to bind to it. We basically just want to require thatget_env()
finds a const-qualified member-function. The use ofas_const()
does not seem to mirror the semantics of a function with aconst 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)
?The text was updated successfully, but these errors were encountered: