within algorithm from P3955#288
Conversation
Also add additional concepts from the paper: - `enter_scope_sender` - `enter_scope_sender_in` - `exit_scope_sender` - `exit_scope_sender_in` - `exit_scope_sender_of_t` Add utilities: - `completion_storage` -- allows storing the completions of an async operation to be used later. - `elide` -- helper to elide move ctor; useful for constructing operation states
Fix issue when checking nothrow by connecting to the wrong receiver.
- Storing a cvref-removed receiver in `within` state object - Initialize the receiver before the operation state -- this caused UB - add appropriate headers in `exec-within.test.cpp` - remove unused variables from test
dietmarkuehl
left a comment
There was a problem hiding this comment.
I'm not sure that I understand what within actually does (I should read the paper). There are a few comments which would be cool to address: in particular I think the single sender tools already exist and some of the other tools seem useful otherwise, too.
| template <typename Sig> | ||
| inline constexpr bool is_value_completion_sig = false; | ||
| template <typename... Args> | ||
| inline constexpr bool is_value_completion_sig<::beman::execution::set_value_t(Args...)> = true; |
There was a problem hiding this comment.
There is something like that in include/beman/execution/detail/completion_signature.hpp: is_set_value. It isn't a bool variable template, though. The specialization is certainly needed just once and maybe its use should be unified.
| template <typename... Sigs> | ||
| struct single_value_sender; | ||
|
|
||
| template <typename T, typename... Rest> | ||
| requires(!(::beman::execution::detail::is_value_completion_sig<Rest> || ...)) | ||
| struct single_value_sender<::beman::execution::set_value_t(T), Rest...> { | ||
| using type = T; | ||
| }; | ||
|
|
||
| template <typename First, typename... Rest> | ||
| requires(!::beman::execution::detail::is_value_completion_sig<First>) | ||
| struct single_value_sender<First, Rest...> : ::beman::execution::detail::single_value_sender<Rest...> {}; | ||
|
|
There was a problem hiding this comment.
There is a concept single_sender which could probably do some of the work. It seems, single_value_sender also extracts the argument type, though.
single_sender is an exposition-only concept from the specification. It actually uses single_sender_value_type which is an exposition-only type alias also from the specification. I'd think these can be used directly.
Also add additional concepts from the paper:
enter_scope_senderenter_scope_sender_inexit_scope_senderexit_scope_sender_inexit_scope_sender_of_tAdd utilities:
completion_storage-- allows storing the completions of an async operation to be used later.elide-- helper to elide move ctor; useful for constructing operation states