diff --git a/include/exec/create.hpp b/include/exec/create.hpp index 4bd0c71da..172b79c8c 100644 --- a/include/exec/create.hpp +++ b/include/exec/create.hpp @@ -38,46 +38,54 @@ namespace exec { template struct __operation { - using _Context = __context<__t<_ReceiverId>, __t<_ArgsId>>; + using _Context = __context, stdexec::__t<_ArgsId>>; using _Result = __call_result_t<_Fun, _Context&>; using _State = __if_c, __void, std::optional<_Result>>; - STDEXEC_ATTRIBUTE((no_unique_address)) _Context __ctx_; - STDEXEC_ATTRIBUTE((no_unique_address)) _Fun __fun_; - STDEXEC_ATTRIBUTE((no_unique_address)) _State __state_{}; + struct __t { + using __id = __operation; - friend void tag_invoke(start_t, __operation& __self) noexcept { - __self.__state_.emplace(__conv{[&]() noexcept { - return ((_Fun&&) __self.__fun_)(__self.__ctx_); - }}); - } + STDEXEC_ATTRIBUTE((no_unique_address)) _Context __ctx_; + STDEXEC_ATTRIBUTE((no_unique_address)) _Fun __fun_; + STDEXEC_ATTRIBUTE((no_unique_address)) _State __state_{}; + + friend void tag_invoke(start_t, __t& __self) noexcept { + __self.__state_.emplace(__conv{[&]() noexcept { + return ((_Fun&&) __self.__fun_)(__self.__ctx_); + }}); + } + }; }; template struct __sender { - using _Args = __t<_ArgsId>; - using sender_concept = stdexec::sender_t; - using completion_signatures = stdexec::completion_signatures<_Sigs...>; + using _Args = stdexec::__t<_ArgsId>; - _Fun __fun_; - _Args __args_; + struct __t { + using __id = __sender; + using sender_concept = stdexec::sender_t; + using completion_signatures = stdexec::completion_signatures<_Sigs...>; - template <__decays_to<__sender> _Self, receiver_of _Receiver> - requires __callable<_Fun, __context<_Receiver, _Args>&> - && constructible_from<_Fun, __copy_cvref_t<_Self, _Fun>> - && constructible_from<_Args, __copy_cvref_t<_Self, _Args>> - friend auto tag_invoke(connect_t, _Self&& __self, _Receiver __rcvr) - -> __operation<__x<_Receiver>, _Fun, _ArgsId> { - static_assert(__nothrow_callable<_Fun, __context<_Receiver, _Args>&>); - return { - {(_Receiver&&) __rcvr, ((_Self&&) __self).__args_}, - ((_Self&&) __self).__fun_ - }; - } + _Fun __fun_; + _Args __args_; - friend empty_env tag_invoke(get_env_t, const __sender&) noexcept { - return {}; - } + template <__decays_to<__t> _Self, receiver_of _Receiver> + requires __callable<_Fun, __context<_Receiver, _Args>&> + && constructible_from<_Fun, __copy_cvref_t<_Self, _Fun>> + && constructible_from<_Args, __copy_cvref_t<_Self, _Args>> + friend auto tag_invoke(connect_t, _Self&& __self, _Receiver __rcvr) + -> stdexec::__t<__operation, _Fun, _ArgsId>> { + static_assert(__nothrow_callable<_Fun, __context<_Receiver, _Args>&>); + return { + {(_Receiver&&) __rcvr, ((_Self&&) __self).__args_}, + ((_Self&&) __self).__fun_ + }; + } + + friend empty_env tag_invoke(get_env_t, const __t&) noexcept { + return {}; + } + }; }; template <__completion_signature... _Sigs> @@ -85,7 +93,7 @@ namespace exec { template requires move_constructible<_Fun> && constructible_from<__decayed_tuple<_Args...>, _Args...> auto operator()(_Fun __fun, _Args&&... __args) const - -> __sender<_Fun, __x<__decayed_tuple<_Args...>>, _Sigs...> { + -> __t<__sender<_Fun, __id<__decayed_tuple<_Args...>>, _Sigs...>> { return {(_Fun&&) __fun, {(_Args&&) __args...}}; } };