2828#include < concepts>
2929#include < type_traits>
3030
31+ #include < beman/execution/detail/suppress_push.hpp>
32+
3133// ----------------------------------------------------------------------------
3234
3335namespace beman ::execution::detail {
@@ -63,6 +65,21 @@ struct affine_on_t : ::beman::execution::sender_adaptor_closure<affine_on_t> {
6365 */
6466 auto operator ()() const { return ::beman::execution::detail::sender_adaptor{*this }; }
6567
68+ template <typename Ev>
69+ struct ao_env {
70+ Ev ev_;
71+ auto query (const ::beman::execution::get_stop_token_t &) const noexcept
72+ -> ::beman::execution::never_stop_token {
73+ return ::beman::execution::never_stop_token ();
74+ }
75+ template <typename Q>
76+ auto query (const Q& q) const noexcept -> decltype(q(this ->ev_)) {
77+ return q (this ->ev_ );
78+ }
79+ };
80+ template <typename Ev>
81+ ao_env (const Ev&) -> ao_env<Ev>;
82+
6683 /* *
6784 * @brief affine_on is implemented by transforming it into a use of schedule_from.
6885 *
@@ -89,35 +106,33 @@ struct affine_on_t : ::beman::execution::sender_adaptor_closure<affine_on_t> {
89106 ::beman::execution::get_completion_signatures (
90107 ::beman::execution::schedule (::beman::execution::get_scheduler(env)),
91108 ::beman::execution::detail::join_env(
92- ::beman::execution::env{::beman::execution::prop{::beman::execution::get_stop_token,
93- ::beman::execution::never_stop_token{}}},
109+ ::beman::execution::env{::beman::execution::prop{
110+ ::beman::execution::get_stop_token, ::beman::execution::never_stop_token{}, {}}},
94111 env))
95112 } -> ::std::same_as<::beman::execution::completion_signatures<::beman::execution::set_value_t ()>>;
96113 }
97- static auto transform_sender (Sender&& sender, const Env& env ) {
114+ static auto transform_sender (Sender&& sender, const Env& ev ) {
98115 [[maybe_unused]] auto & [tag, data, child] = sender;
99116 using child_tag_t = ::beman::execution::tag_of_t <::std::remove_cvref_t <decltype (child)>>;
100117
101118#if 0
102119 if constexpr (requires(const child_tag_t& t) {
103120 {
104- t.affine_on(::beman::execution::detail::forward_like<Sender>(child), env )
121+ t.affine_on(::beman::execution::detail::forward_like<Sender>(child), ev )
105122 } -> ::beman::execution::sender;
106123 })
107124#else
108125 if constexpr (::beman::execution::detail::nested_sender_has_affine_on<Sender, Env>)
109126#endif
110127 {
111- return child_tag_t {}.affine_on (::beman::execution::detail::forward_like<Sender>(child), env);
128+ constexpr child_tag_t t{};
129+ return t.affine_on (::beman::execution::detail::forward_like<Sender>(child), ev);
112130 } else {
113131 return ::beman::execution::write_env (
114132 ::beman::execution::schedule_from (
115- ::beman::execution::get_scheduler (env),
116- ::beman::execution::write_env(::beman::execution::detail::forward_like<Sender>(child), env)),
117- ::beman::execution::detail::join_env(
118- ::beman::execution::env{::beman::execution::prop{::beman::execution::get_stop_token,
119- ::beman::execution::never_stop_token{}}},
120- env));
133+ ::beman::execution::get_scheduler (ev),
134+ ::beman::execution::write_env(::beman::execution::detail::forward_like<Sender>(child), ev)),
135+ ao_env(ev));
121136 }
122137 }
123138};
@@ -135,4 +150,6 @@ inline constexpr affine_on_t affine_on{};
135150
136151// ----------------------------------------------------------------------------
137152
153+ #include < beman/execution/detail/suppress_pop.hpp>
154+
138155#endif
0 commit comments