1
1
// include/beman/execution/detail/bulk.hpp -*-C++-*-
2
2
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3
3
4
- #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_SPLIT
5
- #define INCLUDED_BEMAN_EXECUTION_DETAIL_SPLIT
6
-
7
- #include " beman/execution/detail/basic_sender.hpp"
8
- #include " beman/execution/detail/callable.hpp"
9
- #include " beman/execution/detail/completion_signatures_for.hpp"
10
- #include " beman/execution/detail/get_domain_early.hpp"
11
- #include " beman/execution/detail/make_sender.hpp"
12
- #include " beman/execution/detail/movable_value.hpp"
13
- #include " beman/execution/detail/product_type.hpp"
14
- #include " beman/execution/detail/sender.hpp"
15
- #include " beman/execution/detail/set_error.hpp"
16
- #include " beman/execution/detail/transform_sender.hpp"
4
+ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_BULK
5
+ #define INCLUDED_BEMAN_EXECUTION_DETAIL_BULK
6
+
7
+ #include " beman/execution/detail/error_types_of_t.hpp"
8
+ #include " beman/execution/detail/meta_combine.hpp"
9
+ #include " beman/execution/detail/meta_unique.hpp"
10
+ #include " beman/execution/detail/set_stopped.hpp"
11
+ #include " beman/execution/detail/value_types_of_t.hpp"
12
+ #include < beman/execution/detail/basic_sender.hpp>
13
+ #include < beman/execution/detail/completion_signatures.hpp>
14
+ #include < beman/execution/detail/completion_signatures_for.hpp>
15
+ #include < beman/execution/detail/get_domain_early.hpp>
16
+ #include < beman/execution/detail/make_sender.hpp>
17
+ #include < beman/execution/detail/movable_value.hpp>
18
+ #include < beman/execution/detail/product_type.hpp>
19
+ #include < beman/execution/detail/sender.hpp>
20
+ #include < beman/execution/detail/set_error.hpp>
21
+ #include < beman/execution/detail/transform_sender.hpp>
17
22
#include < beman/execution/detail/default_impls.hpp>
18
23
#include < beman/execution/detail/impls_for.hpp>
19
24
#include < beman/execution/detail/set_value.hpp>
23
28
#include < type_traits>
24
29
#include < utility>
25
30
31
+
32
+ #include < beman/execution/detail/suppress_push.hpp>
26
33
namespace beman ::execution::detail {
27
34
28
35
struct bulk_t {
29
36
30
- /*
31
37
32
- decltype((sndr)) does not satisfy sender, or
33
- Shape does not satisfy integral, or
34
- decltype((f)) does not satisfy movable-value,
35
- */
36
38
template <class Sender , class Shape , class f >
37
39
requires (::beman::execution::sender<Sender> && std::is_integral_v<Shape> &&
38
40
::beman::execution::detail::movable_value<f>)
@@ -53,9 +55,9 @@ struct impls_for<bulk_t> : ::beman::execution::detail::default_impls {
53
55
static constexpr auto complete = []<class Index , class State , class Rcvr , class Tag , class ... Args>(
54
56
Index, State& state, Rcvr& rcvr, Tag, Args&&... args) noexcept -> void
55
57
requires (not ::std::same_as<Tag, set_value_t > ||
56
- ::beman::execution::detail::callable<
57
- Tag,
58
- Args...> /* expression f(auto(shape), args...) is well-formed. dont know if this is ok */ )
58
+ requires (State& s, Args&&... a) {
59
+ (s. template get < 1 >())(s. template get < 0 >(), ::std::forward<Args>(a)...);
60
+ } )
59
61
{
60
62
if constexpr (std::same_as<Tag, set_value_t >) {
61
63
auto & [shape, f] = state;
@@ -81,13 +83,43 @@ struct impls_for<bulk_t> : ::beman::execution::detail::default_impls {
81
83
};
82
84
83
85
template <class Shape , class f , class Sender , class Env >
84
- struct completion_signatures_for <
86
+ struct completion_signatures_for_impl <
85
87
::beman::execution::detail::
86
88
basic_sender<::beman::execution::detail::bulk_t , ::beman::execution::detail::product_type<Shape, f>, Sender>,
87
- Env> {};
89
+ Env> {
90
+
91
+ // Creates a completion signature for set_value_t`
92
+ template <class ... Args>
93
+ using make_value_completions =
94
+ ::beman::execution::completion_signatures<::beman::execution::set_value_t (const std::decay_t <Args>&...)>;
95
+
96
+ // Creates a completion signature for set_error_t
97
+ template <class ... Args>
98
+ using make_error_completions =
99
+ ::beman::execution::completion_signatures<::beman::execution::set_error_t (const std::decay_t <Args>&)...>;
100
+
101
+ // Retrieves the value completion signatures from the Sender using Env,
102
+ // then applies `make_value_completions` to format them and merges all signatures.
103
+ using value_completions = ::beman::execution::
104
+ value_types_of_t <Sender, Env, make_value_completions, ::beman::execution::detail::meta::combine>;
105
+
106
+ // Retrieves the error completion signatures from the Sender using Env,
107
+ // then applies make_error_completions to format them.
108
+ using error_completions = ::beman::execution::error_types_of_t <Sender, Env, make_error_completions>;
109
+
110
+ using fixed_completions =
111
+ ::beman::execution::completion_signatures<::beman::execution::set_stopped_t (),
112
+ ::beman::execution::set_error_t (std::exception_ptr)>;
113
+
114
+
115
+ using type = ::beman::execution::detail::meta::unique<
116
+ ::beman::execution::detail::meta::combine<fixed_completions, value_completions, error_completions>>;
117
+ };
88
118
89
119
} // namespace beman::execution::detail
90
120
121
+ #include < beman/execution/detail/suppress_pop.hpp>
122
+
91
123
namespace beman ::execution {
92
124
93
125
using ::beman::execution::detail::bulk_t ;
0 commit comments