| 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; |