Skip to content

Commit f2986ca

Browse files
committed
move sender_expr[_for] concepts out of the STDEXEC namespace
1 parent 61707d2 commit f2986ca

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+145
-77
lines changed

include/exec/detail/shared.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ namespace experimental::execution::__shared
496496
template <class _CvSender>
497497
static consteval auto __get_completion_signatures()
498498
{
499-
static_assert(sender_expr_for<_CvSender, _Tag>);
499+
static_assert(STDEXEC::__sender_for<_CvSender, _Tag>);
500500
return __get_completion_signatures_impl<__child_of<_CvSender>,
501501
__decay_t<__data_of<_CvSender>>>();
502502
};

include/exec/ensure_started.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "../stdexec/__detail/__senders.hpp"
2424
#include "../stdexec/__detail/__transform_sender.hpp"
2525
#include "detail/shared.hpp"
26+
#include "sender_for.hpp"
2627

2728
namespace experimental::execution
2829
{
@@ -68,7 +69,7 @@ namespace experimental::execution
6869
static constexpr auto
6970
transform_sender(STDEXEC::set_value_t, _CvSender&& __sndr, STDEXEC::__ignore)
7071
{
71-
static_assert(STDEXEC::sender_expr_for<_CvSender, ensure_started_t>);
72+
static_assert(sender_for<_CvSender, ensure_started_t>);
7273
auto __result = __shared::__sndr{ensure_started_t(),
7374
STDEXEC::__get<2>(static_cast<_CvSender&&>(__sndr)),
7475
STDEXEC::__get<1>(static_cast<_CvSender&&>(__sndr))};

include/exec/libdispatch_queue.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
# endif
2929

3030
# include "../stdexec/execution.hpp"
31+
32+
# include "sender_for.hpp"
33+
3134
# include <dispatch/dispatch.h>
3235

3336
namespace experimental::execution
@@ -91,9 +94,10 @@ namespace experimental::execution
9194
struct domain
9295
{
9396
// transform the generic bulk sender into a parallel libdispatch bulk sender
94-
template <STDEXEC::sender_expr_for<STDEXEC::bulk_t> Sender, class Env>
97+
template <class Sender, class Env>
9598
auto transform_sender(STDEXEC::set_value_t, Sender &&sndr, Env const &env) const noexcept
9699
{
100+
static_assert(sender_for<Sender, STDEXEC::bulk_t>);
97101
if constexpr (STDEXEC::__completes_on<Sender, libdispatch_scheduler, Env>)
98102
{
99103
auto sched =

include/exec/sender_for.hpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright (c) 2022 NVIDIA Corporation
3+
*
4+
* Licensed under the Apache License Version 2.0 with LLVM Exceptions
5+
* (the "License"); you may not use this file except in compliance with
6+
* the License. You may obtain a copy of the License at
7+
*
8+
* https://llvm.org/LICENSE.txt
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
#pragma once
17+
18+
#include "../stdexec/__detail/__sender_introspection.hpp"
19+
20+
namespace experimental::execution
21+
{
22+
template <class _Sender, class... _Tag>
23+
concept sender_for = STDEXEC::__sender_for<_Sender, _Tag...>;
24+
} // namespace experimental::execution
25+
26+
namespace exec = experimental::execution;

include/exec/sequence/ignore_all_values.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
// include these after execution.hpp
2222
#include "../../stdexec/__detail/__tuple.hpp"
2323
#include "../../stdexec/__detail/__variant.hpp"
24+
#include "../sender_for.hpp"
2425
#include "../sequence_senders.hpp"
2526

2627
#include "../../stdexec/__detail/__atomic.hpp"
@@ -316,7 +317,7 @@ namespace experimental::execution
316317
template <class _Sender, class... _Env>
317318
static consteval auto __get_completion_signatures()
318319
{
319-
static_assert(sender_expr_for<_Sender, ignore_all_values_t>);
320+
static_assert(sender_for<_Sender, ignore_all_values_t>);
320321
return __sequence_completion_signatures_of<__child_of<_Sender>, _Env...>();
321322
}
322323

@@ -325,7 +326,7 @@ namespace experimental::execution
325326
__nothrow_applicable<__connect_fn, _Sender, _Receiver&>)
326327
-> __apply_result_t<__connect_fn, _Sender, _Receiver&>
327328
{
328-
static_assert(sender_expr_for<_Sender, ignore_all_values_t>);
329+
static_assert(sender_for<_Sender, ignore_all_values_t>);
329330
return __apply(__connect_fn(), static_cast<_Sender&&>(__sndr), __rcvr);
330331
};
331332
};

include/exec/sequence/iterate.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
# include "../../stdexec/execution.hpp"
2525

2626
# include "../detail/basic_sequence.hpp"
27+
# include "../sender_for.hpp"
2728
# include "../sequence.hpp"
2829
# include "../sequence_senders.hpp"
2930
# include "../trampoline_scheduler.hpp"
@@ -203,13 +204,14 @@ namespace experimental::execution
203204
template <class _Sequence, class _Receiver>
204205
using _NextSender = next_sender_of_t<_Receiver, __item_sender_t<_Sequence>>;
205206

206-
template <sender_expr_for<iterate_t> _SeqExpr,
207+
template <class _SeqExpr,
207208
sequence_receiver_of<item_types<__item_sender_t<_SeqExpr>>> _Receiver>
208209
requires sender_to<_NextSender<_SeqExpr, _Receiver>, _NextReceiver<_SeqExpr, _Receiver>>
209210
static constexpr auto subscribe(_SeqExpr&& __seq, _Receiver __rcvr)
210211
noexcept(__nothrow_applicable<__subscribe_fn<_Receiver>, _SeqExpr>)
211212
-> __apply_result_t<__subscribe_fn<_Receiver>, _SeqExpr>
212213
{
214+
static_assert(sender_for<_SeqExpr, iterate_t>);
213215
return __apply(__subscribe_fn<_Receiver>{__rcvr}, static_cast<_SeqExpr&&>(__seq));
214216
}
215217

@@ -221,9 +223,10 @@ namespace experimental::execution
221223
set_stopped_t()>();
222224
}
223225

224-
template <sender_expr_for<iterate_t> _Sequence, class... _Env>
226+
template <class _Sequence, class... _Env>
225227
static consteval auto get_item_types() noexcept
226228
{
229+
static_assert(sender_for<_Sequence, iterate_t>);
227230
return item_types<__item_sender_t<_Sequence>>();
228231
}
229232

include/exec/sequence/merge.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "../../stdexec/execution.hpp"
2020

2121
#include "../detail/basic_sequence.hpp"
22+
#include "../sender_for.hpp"
2223
#include "../sequence_senders.hpp"
2324
#include "ignore_all_values.hpp"
2425
#include "transform_each.hpp"
@@ -175,7 +176,7 @@ namespace experimental::execution
175176
template <class _Self, class... _Env>
176177
static consteval auto get_completion_signatures() noexcept
177178
{
178-
static_assert(STDEXEC::sender_expr_for<_Self, merge_t>);
179+
static_assert(sender_for<_Self, merge_t>);
179180
auto __items = STDEXEC::__children_of<_Self, STDEXEC::__qq<item_types>>();
180181
return exec::concat_completion_signatures(
181182
completion_signatures<set_stopped_t()>(),
@@ -185,7 +186,7 @@ namespace experimental::execution
185186
template <class _Self, class... _Env>
186187
static consteval auto get_item_types()
187188
{
188-
static_assert(sender_expr_for<_Self, merge_t>);
189+
static_assert(sender_for<_Self, merge_t>);
189190
auto __items = STDEXEC::__children_of<_Self, STDEXEC::__qq<item_types>>();
190191
return __items.__transform(__mk_get_item_types<_Env...>(), __mk_unique_concat_items());
191192
}
@@ -195,7 +196,7 @@ namespace experimental::execution
195196
noexcept(__nothrow_applicable<__subscribe_fn, _Self, _Receiver&>)
196197
-> __apply_result_t<__subscribe_fn, _Self, _Receiver&>
197198
{
198-
static_assert(sender_expr_for<_Self, merge_t>);
199+
static_assert(sender_for<_Self, merge_t>);
199200
return STDEXEC::__apply(__subscribe_fn{}, static_cast<_Self&&>(__self), __rcvr);
200201
}
201202
};

include/exec/sequence/merge_each.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "../../stdexec/__detail/__transform_completion_signatures.hpp"
3434
#include "../../stdexec/__detail/__variant.hpp"
3535
#include "../detail/basic_sequence.hpp"
36+
#include "../sender_for.hpp"
3637

3738
#include <atomic>
3839

@@ -1277,9 +1278,10 @@ namespace experimental::execution
12771278
return make_sequence_expr<merge_each_t>(__(), static_cast<_Sequence&&>(__sequence));
12781279
}
12791280

1280-
template <sender_expr_for<merge_each_t> _Self, class... _Env>
1281+
template <class _Self, class... _Env>
12811282
static consteval auto get_item_types()
12821283
{
1284+
static_assert(sender_for<_Self, merge_each_t>);
12831285
using __result_t =
12841286
__compute::__nested_values_t<__child_of<_Self>,
12851287
__env_with_inplace_stop_token_result_t<_Env>...>;
@@ -1310,7 +1312,7 @@ namespace experimental::execution
13101312
template <class _Self, class... _Env>
13111313
static consteval auto get_completion_signatures()
13121314
{
1313-
static_assert(sender_expr_for<_Self, merge_each_t>);
1315+
static_assert(sender_for<_Self, merge_each_t>);
13141316
// TODO: update this to use constant evaluation:
13151317
using __result_t = __minvoke<__mtry_q<__completions_t>,
13161318
_Self,
@@ -1331,7 +1333,7 @@ namespace experimental::execution
13311333
__nothrow_applicable<__subscribe_fn<_Receiver>, _Sequence>)
13321334
-> __apply_result_t<__subscribe_fn<_Receiver>, _Sequence>
13331335
{
1334-
static_assert(sender_expr_for<_Sequence, merge_each_t>);
1336+
static_assert(sender_for<_Sequence, merge_each_t>);
13351337
return __apply(__subscribe_fn<_Receiver>{__rcvr}, static_cast<_Sequence&&>(__sndr));
13361338
};
13371339
};

include/exec/sequence/transform_each.hpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include "../../stdexec/concepts.hpp"
2020
#include "../../stdexec/execution.hpp"
21+
#include "../sender_for.hpp"
2122
#include "../sequence_senders.hpp"
2223

2324
#include "../detail/basic_sequence.hpp"
@@ -155,7 +156,7 @@ namespace experimental::execution
155156
template <class _Self, class... _Env>
156157
static consteval auto get_completion_signatures()
157158
{
158-
static_assert(sender_expr_for<_Self, transform_each_t>);
159+
static_assert(sender_for<_Self, transform_each_t>);
159160
return exec::__sequence_completion_signatures_of<__child_of<_Self>, _Env...>();
160161
}
161162

@@ -170,7 +171,7 @@ namespace experimental::execution
170171
template <class _Self, class... _Env>
171172
static consteval auto get_item_types()
172173
{
173-
static_assert(sender_expr_for<_Self, transform_each_t>);
174+
static_assert(sender_for<_Self, transform_each_t>);
174175
using __closure_t = STDEXEC::__decay_t<__data_of<_Self>>&;
175176
auto __child_items = exec::get_item_types<__child_of<_Self>, _Env...>();
176177

@@ -206,17 +207,19 @@ namespace experimental::execution
206207
template <class _Self, class _Receiver>
207208
using __operation_t = __operation<__child_of<_Self>, _Receiver, __data_of<_Self>>;
208209

209-
template <sender_expr_for<transform_each_t> _Self, receiver _Receiver>
210+
template <class _Self, receiver _Receiver>
210211
static auto subscribe(_Self&& __self, _Receiver __rcvr)
211212
noexcept(__nothrow_applicable<__subscribe_fn<_Receiver>, _Self>)
212213
-> __apply_result_t<__subscribe_fn<_Receiver>, _Self>
213214
{
215+
static_assert(sender_for<_Self, transform_each_t>);
214216
return __apply(__subscribe_fn<_Receiver>{__rcvr}, static_cast<_Self&&>(__self));
215217
}
216218

217-
template <sender_expr_for<transform_each_t> _Sexpr>
219+
template <class _Sexpr>
218220
static auto get_env(_Sexpr const & __sexpr) noexcept -> env_of_t<__child_of<_Sexpr>>
219221
{
222+
static_assert(sender_for<_Sexpr, transform_each_t>);
220223
return __apply([]<class _Child>(__ignore, __ignore, _Child const & __child)
221224
{ return STDEXEC::get_env(__child); },
222225
__sexpr);

include/exec/split.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "../stdexec/__detail/__senders.hpp"
2424
#include "../stdexec/__detail/__transform_sender.hpp"
2525
#include "detail/shared.hpp"
26+
#include "sender_for.hpp"
2627

2728
namespace experimental::execution
2829
{
@@ -51,7 +52,7 @@ namespace experimental::execution
5152
static constexpr auto
5253
transform_sender(STDEXEC::set_value_t, _CvSender&& __sndr, STDEXEC::__ignore)
5354
{
54-
static_assert(STDEXEC::sender_expr_for<_CvSender, split_t>);
55+
static_assert(sender_for<_CvSender, split_t>);
5556
return __shared::__sndr{split_t(),
5657
STDEXEC::__get<2>(static_cast<_CvSender&&>(__sndr)),
5758
STDEXEC::__get<1>(static_cast<_CvSender&&>(__sndr))};

0 commit comments

Comments
 (0)