@@ -43,80 +43,71 @@ import beman.execution.detail.start;
4343// ----------------------------------------------------------------------------
4444
4545namespace beman ::execution::detail {
46- struct store_receiver_t {
47- template <::beman::execution::receiver Rcvr>
48- struct receiver {
49- using receiver_concept = ::beman::execution::receiver_t ;
50- Rcvr* rcvr;
51- template <typename ... Args>
52- auto set_value (Args&&... args) && noexcept -> void {
53- ::beman::execution::set_value (::std::move(*this ->rcvr), ::std::forward<Args>(args)...);
54- }
55- template <typename Error>
56- auto set_error (Error&& error) && noexcept -> void {
57- ::beman::execution::set_error (::std::move(*this ->rcvr), ::std::forward<Error>(error));
58- }
59- auto set_stopped () && noexcept -> void {
60- ::beman::execution::set_stopped (::std::move(*this ->rcvr));
61- }
62- auto get_env () const noexcept {
63- return ::beman::execution::get_env (*this ->rcvr );
64- }
65- };
66- template <::beman::execution::sender Sndr, typename Trans, ::beman::execution::receiver Rcvr>
67- struct state {
68- using operation_state_concept = ::beman::execution::operation_state_t ;
69- using env_t = ::beman::execution::env_of_t <Rcvr>;
70- using state_t = ::beman::execution::connect_result_t <
71- decltype (::std::declval<Trans>()(::std::declval<Sndr>(), ::std::declval<env_t >())),
72- receiver<Rcvr>>;
73- Rcvr rcvr;
74- state_t op_state;
75- template <::beman::execution::sender S, typename T, ::beman::execution::receiver R>
76- state (S&& sndr, T&& trans, R&& r) :
77- rcvr (::std::forward<Rcvr>(::std::forward<R>(r)))
78- ,op_state(
79- ::beman::execution::connect (
80- ::std::forward<T>(trans)(::std::forward<S>(sndr), ::beman::execution::get_env(this ->rcvr)),
81- receiver<Rcvr>{::std::addressof (this ->rcvr )}
82- )
83- )
84- {}
85- auto start () & noexcept {
86- ::beman::execution::start (this ->op_state);
87- }
88- };
89- template <::beman::execution::sender Sndr, typename Trans>
90- struct sender {
91- using sender_concept = ::beman::execution::sender_t ;
92- template <typename ... Env>
93- static consteval auto get_completion_signatures (Env&&... env) noexcept {
94- return ::beman::execution::get_completion_signatures<::std::remove_cvref_t <Sndr>, Env...>();
95- }
96- ::std::remove_cvref_t <Sndr> sndr;
97- ::std::remove_cvref_t <Trans> trans;
98-
99- template <::beman::execution::receiver Receiver>
100- auto connect (Receiver&& r) && {
101- static_assert (::beman::execution::operation_state<state<Sndr, Trans, ::std::remove_cvref_t <Receiver>>>);
102- return state<Sndr, Trans, ::std::remove_cvref_t <Receiver>>(::std::move (this ->sndr ), ::std::move (this ->trans ), ::std::forward<Receiver>(r));
103- }
104- template <::beman::execution::receiver Receiver>
105- auto connect (Receiver&& r) const & {
106- static_assert (::beman::execution::operation_state<state<Sndr, Trans, ::std::remove_cvref_t <Receiver>>>);
107- return state<Sndr, Trans, ::std::remove_cvref_t <Receiver>>(this ->sndr , this ->trans , ::std::forward<Receiver>(r));
108- }
109- };
110- template <::beman::execution::sender Sndr, typename Trans>
111- auto operator ()(Sndr&& sndr, Trans&& trans) const {
112- static_assert (::beman::execution::sender<sender<Sndr, Trans>>);
113- return sender<Sndr, Trans>{::std::forward<Sndr>(sndr), ::std::forward<Trans>(trans)};
46+ struct store_receiver_t {
47+ template <::beman::execution::receiver Rcvr>
48+ struct receiver {
49+ using receiver_concept = ::beman::execution::receiver_t ;
50+ Rcvr* rcvr;
51+ template <typename ... Args>
52+ auto set_value (Args&&... args) && noexcept -> void {
53+ ::beman::execution::set_value (::std::move(*this ->rcvr), ::std::forward<Args>(args)...);
54+ }
55+ template <typename Error>
56+ auto set_error (Error&& error) && noexcept -> void {
57+ ::beman::execution::set_error (::std::move(*this ->rcvr), ::std::forward<Error>(error));
11458 }
59+ auto set_stopped () && noexcept -> void { ::beman::execution::set_stopped (::std::move (*this ->rcvr )); }
60+ auto get_env () const noexcept { return ::beman::execution::get_env (*this ->rcvr ); }
11561 };
62+ template <::beman::execution::sender Sndr, typename Trans, ::beman::execution::receiver Rcvr>
63+ struct state {
64+ using operation_state_concept = ::beman::execution::operation_state_t ;
65+ using env_t = ::beman::execution::env_of_t <Rcvr>;
66+ using state_t = ::beman::execution::connect_result_t <decltype (::std::declval<Trans>()(
67+ ::std::declval<Sndr>(), ::std::declval<env_t >())),
68+ receiver<Rcvr>>;
69+ Rcvr rcvr;
70+ state_t op_state;
71+ template <::beman::execution::sender S, typename T, ::beman::execution::receiver R>
72+ state (S&& sndr, T&& trans, R&& r)
73+ : rcvr(::std::forward<Rcvr>(::std::forward<R>(r))),
74+ op_state (::beman::execution::connect(
75+ ::std::forward<T>(trans)(::std::forward<S>(sndr), ::beman::execution::get_env(this ->rcvr)),
76+ receiver<Rcvr>{::std::addressof (this ->rcvr )})) {}
77+ auto start () & noexcept { ::beman::execution::start (this ->op_state ); }
78+ };
79+ template <::beman::execution::sender Sndr, typename Trans>
80+ struct sender {
81+ using sender_concept = ::beman::execution::sender_t ;
82+ template <typename ... Env>
83+ static consteval auto get_completion_signatures (Env&&... env) noexcept {
84+ return ::beman::execution::get_completion_signatures<::std::remove_cvref_t <Sndr>, Env...>();
85+ }
86+ ::std::remove_cvref_t <Sndr> sndr;
87+ ::std::remove_cvref_t <Trans> trans;
11688
117- inline constexpr store_receiver_t store_receiver{};
118- }
89+ template <::beman::execution::receiver Receiver>
90+ auto connect (Receiver&& r) && {
91+ static_assert (::beman::execution::operation_state<state<Sndr, Trans, ::std::remove_cvref_t <Receiver>>>);
92+ return state<Sndr, Trans, ::std::remove_cvref_t <Receiver>>(
93+ ::std::move (this ->sndr), ::std::move(this ->trans), ::std::forward<Receiver>(r));
94+ }
95+ template <::beman::execution::receiver Receiver>
96+ auto connect (Receiver&& r) const & {
97+ static_assert (::beman::execution::operation_state<state<Sndr, Trans, ::std::remove_cvref_t <Receiver>>>);
98+ return state<Sndr, Trans, ::std::remove_cvref_t <Receiver>>(
99+ this ->sndr , this ->trans , ::std::forward<Receiver>(r));
100+ }
101+ };
102+ template <::beman::execution::sender Sndr, typename Trans>
103+ auto operator ()(Sndr&& sndr, Trans&& trans) const {
104+ static_assert (::beman::execution::sender<sender<Sndr, Trans>>);
105+ return sender<Sndr, Trans>{::std::forward<Sndr>(sndr), ::std::forward<Trans>(trans)};
106+ }
107+ };
119108
109+ inline constexpr store_receiver_t store_receiver{};
110+ } // namespace beman::execution::detail
120111
121112// ----------------------------------------------------------------------------
122113
0 commit comments