From ffbf23d328fff0b814761d58b7823415e90f651e Mon Sep 17 00:00:00 2001 From: Eric Niebler Date: Wed, 18 Oct 2023 14:19:34 -0700 Subject: [PATCH] express __get_sender_domain in terms of __get_env_domain --- include/stdexec/execution.hpp | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/include/stdexec/execution.hpp b/include/stdexec/execution.hpp index 121399ca5..af1031009 100644 --- a/include/stdexec/execution.hpp +++ b/include/stdexec/execution.hpp @@ -628,29 +628,12 @@ namespace stdexec { { get_env(std::as_const(__ep)) } -> __none_of; }; - ///////////////////////////////////////////////////////////////////////////// - inline constexpr struct __get_sender_domain_t { - template - auto operator()(const _Sender& __sndr, _Tag = {}) const noexcept { - // Find the sender's completion scheduler, or empty_env if it doesn't have one. - auto __sched = query_or(get_completion_scheduler<_Tag>, get_env(__sndr), empty_env()); - - // Find the domain by first asking the sender's env, then the completion scheduler, - // and finally using the default domain (which wraps the completion scheduler) - auto __env = __join_env(get_env(__sndr), __sched); - return query_or(get_domain, __env, default_domain()); - } - } __get_sender_domain{}; - - template - using __sender_domain_of_t = __call_result_t<__get_sender_domain_t, _Sender, _Tag>; - ///////////////////////////////////////////////////////////////////////////// inline constexpr struct __get_env_domain_t { - template - auto operator()(const _Env& __env) const noexcept { + template + auto operator()(const _Env& __env, _Tag __tag = {}) const noexcept { // Find the current scheduler, or empty_env if there isn't one. - auto __sched = query_or(get_scheduler, __env, empty_env()); + auto __sched = query_or(__tag, __env, empty_env()); // Find the domain by first asking the env, then the current scheduler, // and finally using the default domain if all else fails. @@ -662,6 +645,17 @@ namespace stdexec { template using __env_domain_of_t = __call_result_t<__get_env_domain_t, _Env>; + ///////////////////////////////////////////////////////////////////////////// + inline constexpr struct __get_sender_domain_t { + template + auto operator()(const _Sender& __sndr, _Tag = {}) const noexcept { + return __get_env_domain(get_env(__sndr), get_completion_scheduler<_Tag>); + } + } __get_sender_domain{}; + + template + using __sender_domain_of_t = __call_result_t<__get_sender_domain_t, _Sender, _Tag>; + ///////////////////////////////////////////////////////////////////////////// // [execution.receivers] namespace __receivers {