Open RobertLeahy opened 4 years ago
From my understanding of the paper, the sender
concepts is meant to be used with the &
.&&
references, to indicate if the given scheduler is meant to be used once, or multiple times.
Note that the concept definition, remove_cvref
is applied on S
to check if it is move_constructible
:
template<class S>
concept sender =
move_constructible<remove_cvref_t<S>> &&
!requires {
typename sender_traits<remove_cvref_t<S>>::__unspecialized; // exposition only
};
So, in exmaple you have quouted, then checks sender_to<S, R>
, which then checks if connect on S&&, R&&
(r-values), i.e. looks if sender is one-shot. On the other hand retry
checks sender_to<S&, _retry_receiver<_op<R>, R>>
, i.e. l-value for sender (connected multiple times) and r-value for receiver (because the ops are called only once).
In conclusion, I believe that the intent of concepts allows to check both once/multi sender, by using:
sender_to<S, R>
or equivalent sender_to<S&&, R&&>
for once-sendersender_to<S&, R>
for multi-senderI believe that then()
is expected to be transparent to this. In libunifex transform()
has been made transparent (this uses tag_invoke to provide some of the benefits of deduced-this so that there is only one overload of connect)
https://github.com/facebookexperimental/libunifex/blob/master/include/unifex/transform.hpp#L161-L174
§1.6.2 (description of a hypothetical algorithm
retry
) describes reuse of a sender:Which suggests that senders should be reusable, and that therefore
connect
ought to be callable on lvalue senders. However under my understanding this is contradicted in the formulation of_then_sender
in the immediately preceding section (§1.6.1) which requires thatconnect
only be called on objects of that type which are rvalues:then
andretry
aren't in P0443 but reading these sections left me wondering what the intention was.