diff --git a/include/beman/execution/detail/enter_scope_sender_in.hpp b/include/beman/execution/detail/enter_scope_sender_in.hpp index 5b1eb557..35b39d5a 100644 --- a/include/beman/execution/detail/enter_scope_sender_in.hpp +++ b/include/beman/execution/detail/enter_scope_sender_in.hpp @@ -7,10 +7,12 @@ #include #ifdef BEMAN_HAS_MODULES import beman.execution.detail.enter_scope_sender; +import beman.execution.detail.env; import beman.execution.detail.exit_scope_sender_of_t; import beman.execution.detail.sender_in; #else #include +#include #include #include #endif @@ -18,7 +20,6 @@ import beman.execution.detail.sender_in; // ---------------------------------------------------------------------------- namespace beman::execution { -template /*! * \brief An enter scope sender that can operate in the environment `Env...`. * \headerfile beman/execution/execution.hpp @@ -31,9 +32,10 @@ template * signature is unary, and the type of the value models `exit_sender_in`. * - Semantic: The above exit sender undoes the action of the enter scope sender which sent it. */ +template > concept enter_scope_sender_in = - ::beman::execution::enter_scope_sender && ::beman::execution::sender_in && - requires { typename ::beman::execution::exit_scope_sender_of_t; }; + ::beman::execution::enter_scope_sender && ::beman::execution::sender_in && + requires { typename ::beman::execution::exit_scope_sender_of_t; }; } // namespace beman::execution // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/exit_scope_sender_of_t.hpp b/include/beman/execution/detail/exit_scope_sender_of_t.hpp index a839f96b..2673452e 100644 --- a/include/beman/execution/detail/exit_scope_sender_of_t.hpp +++ b/include/beman/execution/detail/exit_scope_sender_of_t.hpp @@ -12,61 +12,20 @@ import std; #include #endif #ifdef BEMAN_HAS_MODULES -import beman.execution.detail.completion_signatures_of_t; -import beman.execution.detail.completion_signatures; import beman.execution.detail.enter_scope_sender; +import beman.execution.detail.env; import beman.execution.detail.exit_scope_sender_in; -import beman.execution.detail.set_value; +import beman.execution.detail.single_sender_value_type; #else -#include -#include #include +#include #include -#include +#include #endif // ---------------------------------------------------------------------------- namespace beman::execution { - -namespace detail { - -/// `true` if `Sig` is a value completion signature, i.e. `set_value_t(Args...)`. -template -inline constexpr bool is_value_completion_sig = false; -template -inline constexpr bool is_value_completion_sig<::beman::execution::set_value_t(Args...)> = true; - -/// Finds the type T from the unique unary set_value_t(T) in a signature list. -/// Not defined (substitution failure) if there are zero or two or more value signatures, -/// or if the sole value signature is not unary. -template -struct single_value_sender; - -template - requires(!(::beman::execution::detail::is_value_completion_sig || ...)) -struct single_value_sender<::beman::execution::set_value_t(T), Rest...> { - using type = T; -}; - -template - requires(!::beman::execution::detail::is_value_completion_sig) -struct single_value_sender : ::beman::execution::detail::single_value_sender {}; - -/// Helper that extracts the exit scope sender type from a list of completion signatures. -template -struct extract_exit_scope_sender; - -template - requires requires { typename ::beman::execution::detail::single_value_sender::type; } && - ::beman::execution:: - exit_scope_sender_in::type, Env...> -struct extract_exit_scope_sender<::beman::execution::completion_signatures, Env...> { - using type = typename ::beman::execution::detail::single_value_sender::type; -}; - -} // namespace detail - /*! * \brief Represents the type of exit scope sender which an asynchronous operation formed from * `Sender` in `Env...` yield on completion. @@ -77,9 +36,10 @@ struct extract_exit_scope_sender<::beman::execution::completion_signatures -using exit_scope_sender_of_t = typename ::beman::execution::detail:: - extract_exit_scope_sender<::beman::execution::completion_signatures_of_t, Env...>::type; +template <::beman::execution::enter_scope_sender Sender, typename Env = ::beman::execution::env<>> + requires ::beman::execution:: + exit_scope_sender_in<::beman::execution::detail::single_sender_value_type, Env> +using exit_scope_sender_of_t = ::beman::execution::detail::single_sender_value_type; } // namespace beman::execution // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-scope-snd-concepts.test.cpp b/tests/beman/execution/exec-scope-snd-concepts.test.cpp index 64293b12..56afbb77 100644 --- a/tests/beman/execution/exec-scope-snd-concepts.test.cpp +++ b/tests/beman/execution/exec-scope-snd-concepts.test.cpp @@ -81,6 +81,4 @@ TEST(exec_scope_snd_concepts) { using t5 = sender; static_assert(!test_std::enter_scope_sender_in>); - - // TODO: use sender<...> }