MCPcopy Create free account
hub / github.com/NVIDIA/stdexec / __spawn_future_impl

Class __spawn_future_impl

include/stdexec/__detail/__spawn_future.hpp:731–774  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

729 };
730
731 struct __spawn_future_impl : __sexpr_defaults
732 {
733 // __data_of<_Sender> is a unique_ptr specialization
734 template <class _Sender>
735 using __unique_ptr_t = __data_of<std::remove_cvref_t<_Sender>>;
736
737 template <class _Sender>
738 using __spawn_future_state_t = __unique_ptr_t<_Sender>::element_type;
739
740 template <class _Sender, class _Env>
741 using __completions_t = __spawn_future_state_t<_Sender>::template __completions_t<_Env>;
742
743 template <class _Sender, class _Env>
744 static consteval auto __get_completion_signatures() //
745 -> __completions_t<_Sender, _Env>
746 {
747 return {};
748 };
749
750 static constexpr auto __get_state =
751 []<class _Sender, class _Receiver>(_Sender&& __sndr, _Receiver __rcvr) noexcept /* TODO */
752 -> __future_operation<std::remove_cvref_t<_Sender>, _Receiver>
753 {
754 auto& [_, __future] = __sndr;
755 return {std::move(__future), std::move(__rcvr)};
756 };
757
758 static constexpr auto __start = [](auto& __state) noexcept
759 {
760 constexpr bool __non_throwing = noexcept(__state.__run());
761
762 STDEXEC_TRY
763 {
764 __state.__run();
765 }
766 STDEXEC_CATCH_ALL
767 {
768 if constexpr (!__non_throwing)
769 {
770 STDEXEC::set_error(std::move(__state.__rcvr_), std::current_exception());
771 }
772 }
773 };
774 };
775 } // namespace __spawn_future
776
777 using __spawn_future::spawn_future_t;

Callers

nothing calls this directly

Calls 2

set_errorFunction · 0.70
__runMethod · 0.45

Tested by

no test coverage detected