diff --git a/include/beman/execution/detail/affine_on.hpp b/include/beman/execution/detail/affine_on.hpp index 3f3a6ed4..35a6288e 100644 --- a/include/beman/execution/detail/affine_on.hpp +++ b/include/beman/execution/detail/affine_on.hpp @@ -28,6 +28,8 @@ #include #include +#include + // ---------------------------------------------------------------------------- namespace beman::execution::detail { @@ -63,6 +65,21 @@ struct affine_on_t : ::beman::execution::sender_adaptor_closure { */ auto operator()() const { return ::beman::execution::detail::sender_adaptor{*this}; } + template + struct ao_env { + Ev ev_; + auto query(const ::beman::execution::get_stop_token_t&) const noexcept + -> ::beman::execution::never_stop_token { + return ::beman::execution::never_stop_token(); + } + template + auto query(const Q& q) const noexcept -> decltype(q(this->ev_)) { + return q(this->ev_); + } + }; + template + ao_env(const Ev&) -> ao_env; + /** * @brief affine_on is implemented by transforming it into a use of schedule_from. * @@ -89,35 +106,33 @@ struct affine_on_t : ::beman::execution::sender_adaptor_closure { ::beman::execution::get_completion_signatures( ::beman::execution::schedule(::beman::execution::get_scheduler(env)), ::beman::execution::detail::join_env( - ::beman::execution::env{::beman::execution::prop{::beman::execution::get_stop_token, - ::beman::execution::never_stop_token{}}}, + ::beman::execution::env{::beman::execution::prop{ + ::beman::execution::get_stop_token, ::beman::execution::never_stop_token{}, {}}}, env)) } -> ::std::same_as<::beman::execution::completion_signatures<::beman::execution::set_value_t()>>; } - static auto transform_sender(Sender&& sender, const Env& env) { + static auto transform_sender(Sender&& sender, const Env& ev) { [[maybe_unused]] auto& [tag, data, child] = sender; using child_tag_t = ::beman::execution::tag_of_t<::std::remove_cvref_t>; #if 0 if constexpr (requires(const child_tag_t& t) { { - t.affine_on(::beman::execution::detail::forward_like(child), env) + t.affine_on(::beman::execution::detail::forward_like(child), ev) } -> ::beman::execution::sender; }) #else if constexpr (::beman::execution::detail::nested_sender_has_affine_on) #endif { - return child_tag_t{}.affine_on(::beman::execution::detail::forward_like(child), env); + constexpr child_tag_t t{}; + return t.affine_on(::beman::execution::detail::forward_like(child), ev); } else { return ::beman::execution::write_env( ::beman::execution::schedule_from( - ::beman::execution::get_scheduler(env), - ::beman::execution::write_env(::beman::execution::detail::forward_like(child), env)), - ::beman::execution::detail::join_env( - ::beman::execution::env{::beman::execution::prop{::beman::execution::get_stop_token, - ::beman::execution::never_stop_token{}}}, - env)); + ::beman::execution::get_scheduler(ev), + ::beman::execution::write_env(::beman::execution::detail::forward_like(child), ev)), + ao_env(ev)); } } }; @@ -135,4 +150,6 @@ inline constexpr affine_on_t affine_on{}; // ---------------------------------------------------------------------------- +#include + #endif diff --git a/include/beman/execution/detail/prop.hpp b/include/beman/execution/detail/prop.hpp index 73b95e03..56d23476 100644 --- a/include/beman/execution/detail/prop.hpp +++ b/include/beman/execution/detail/prop.hpp @@ -20,7 +20,7 @@ template struct prop; template -prop(Query, Value) -> prop>; +prop(Query, Value, ::beman::execution::detail::non_assignable = {}) -> prop>; } // namespace beman::execution template