|
17 | 17 |
|
18 | 18 | #include "__execution_fwd.hpp" |
19 | 19 |
|
20 | | -#include "__basic_sender.hpp" |
21 | | -#include "__cpo.hpp" |
22 | 20 | #include "__env.hpp" |
23 | 21 | #include "__receivers.hpp" |
24 | 22 | #include "__schedulers.hpp" |
25 | | -#include "__utility.hpp" |
26 | 23 |
|
27 | 24 | namespace stdexec { |
28 | | - namespace __inln { |
29 | | - struct __schedule_t { }; |
| 25 | + struct inline_scheduler { |
| 26 | + private: |
| 27 | + template <class _Receiver> |
| 28 | + struct __opstate { |
| 29 | + using __id = __opstate; |
| 30 | + using __t = __opstate; |
30 | 31 |
|
31 | | - struct __scheduler { |
32 | | - using __t = __scheduler; |
33 | | - using __id = __scheduler; |
| 32 | + using operation_state_concept = operation_state_t; |
34 | 33 |
|
35 | | - template <class _Tag = __schedule_t> |
36 | | - STDEXEC_ATTRIBUTE(nodiscard, host, device) |
37 | | - auto schedule() const noexcept { |
38 | | - return __make_sexpr<_Tag>(); |
39 | | - } |
40 | | - |
41 | | - [[nodiscard]] |
42 | | - auto query(get_forward_progress_guarantee_t) const noexcept -> forward_progress_guarantee { |
43 | | - return forward_progress_guarantee::weakly_parallel; |
| 34 | + STDEXEC_ATTRIBUTE(host, device) |
| 35 | + constexpr void start() noexcept { |
| 36 | + stdexec::set_value(static_cast<_Receiver&&>(__rcvr_)); |
44 | 37 | } |
45 | 38 |
|
46 | | - auto operator==(const __scheduler&) const noexcept -> bool = default; |
| 39 | + _Receiver __rcvr_; |
47 | 40 | }; |
48 | 41 |
|
49 | | - struct __env { |
| 42 | + struct __attrs { |
| 43 | + STDEXEC_ATTRIBUTE(nodiscard, host, device) |
50 | 44 | static constexpr auto query(__is_scheduler_affine_t) noexcept -> bool { |
51 | 45 | return true; |
52 | 46 | } |
53 | 47 |
|
54 | | - [[nodiscard]] |
55 | | - constexpr auto query(get_completion_scheduler_t<set_value_t>) const noexcept -> __scheduler { |
| 48 | + STDEXEC_ATTRIBUTE(nodiscard, host, device) |
| 49 | + static constexpr auto query(get_completion_scheduler_t<set_value_t>) noexcept // |
| 50 | + -> inline_scheduler { |
56 | 51 | return {}; |
57 | 52 | } |
58 | 53 | }; |
59 | | - } // namespace __inln |
60 | 54 |
|
61 | | - template <> |
62 | | - struct __sexpr_impl<__inln::__schedule_t> : __sexpr_defaults { |
63 | | - static constexpr auto get_attrs = [](__ignore) noexcept { |
64 | | - return __inln::__env(); |
| 55 | + struct __sender { |
| 56 | + using __id = __sender; |
| 57 | + using __t = __sender; |
| 58 | + |
| 59 | + using sender_concept = sender_t; |
| 60 | + using completion_signatures = stdexec::completion_signatures<set_value_t()>; |
| 61 | + |
| 62 | + template <class _Receiver> |
| 63 | + STDEXEC_ATTRIBUTE(nodiscard, host, device) |
| 64 | + static constexpr auto connect(_Receiver __rcvr) noexcept -> __opstate<_Receiver> { |
| 65 | + return {static_cast<_Receiver&&>(__rcvr)}; |
| 66 | + } |
| 67 | + |
| 68 | + STDEXEC_ATTRIBUTE(nodiscard, host, device) |
| 69 | + static constexpr auto get_env() noexcept -> __attrs { |
| 70 | + return {}; |
| 71 | + } |
65 | 72 | }; |
66 | 73 |
|
67 | | - static constexpr auto get_completion_signatures = |
68 | | - [](__ignore, __ignore = {}) noexcept -> completion_signatures<set_value_t()> { |
| 74 | + public: |
| 75 | + using __t = inline_scheduler; |
| 76 | + using __id = inline_scheduler; |
| 77 | + |
| 78 | + using scheduler_concept = scheduler_t; |
| 79 | + |
| 80 | + STDEXEC_ATTRIBUTE(nodiscard, host, device) |
| 81 | + static constexpr auto schedule() noexcept -> __sender { |
69 | 82 | return {}; |
70 | | - }; |
| 83 | + } |
71 | 84 |
|
72 | | - static constexpr auto start = |
73 | | - []<class _Receiver>(__ignore, _Receiver& __rcvr) noexcept -> void { |
74 | | - stdexec::set_value(static_cast<_Receiver&&>(__rcvr)); |
75 | | - }; |
| 85 | + auto operator==(const inline_scheduler&) const noexcept -> bool = default; |
76 | 86 | }; |
77 | 87 |
|
78 | | - static_assert(__is_scheduler_affine<schedule_result_t<__inln::__scheduler>>); |
| 88 | + static_assert(__is_scheduler_affine<schedule_result_t<inline_scheduler>>); |
79 | 89 | } // namespace stdexec |
0 commit comments