Skip to content

Commit 09be84b

Browse files
committed
migrate most senders to use static consteval version of get_completion_signatures
1 parent 58a2a91 commit 09be84b

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

+334
-359
lines changed

examples/algorithms/retry.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,9 @@ struct _retry_sender {
119119
template <class... Ts>
120120
using _value = stdexec::completion_signatures<stdexec::set_value_t(Ts...)>;
121121

122-
template <class Env>
123-
auto get_completion_signatures(Env&&) const -> stdexec::transform_completion_signatures_of<
124-
S&,
125-
Env,
122+
template <class Self, class... Env>
123+
static consteval auto get_completion_signatures() -> stdexec::transform_completion_signatures<
124+
stdexec::completion_signatures_of_t<S&, Env...>,
126125
stdexec::completion_signatures<stdexec::set_error_t(std::exception_ptr)>,
127126
_value,
128127
_error

examples/algorithms/then.hpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,15 @@ struct _then_sender {
6464
using _set_value_t =
6565
stdexec::completion_signatures<stdexec::set_value_t(std::invoke_result_t<F, Args...>)>;
6666

67-
template <class Env>
68-
using _completions_t = stdexec::transform_completion_signatures_of<
69-
S,
70-
Env,
67+
template <class... Env>
68+
using _completions_t = stdexec::transform_completion_signatures<
69+
stdexec::completion_signatures_of_t<S, Env...>,
7170
stdexec::completion_signatures<stdexec::set_error_t(std::exception_ptr)>,
7271
_set_value_t
7372
>;
7473

75-
template <class Env>
76-
auto get_completion_signatures(Env&&) && -> _completions_t<Env> {
74+
template <class, class... Env>
75+
static consteval auto get_completion_signatures() -> _completions_t<Env...> {
7776
return {};
7877
}
7978

examples/benchmark/static_thread_pool_old.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,11 +494,9 @@ namespace exec_old {
494494
STDEXEC_EXPLICIT_THIS_END(connect)
495495

496496
template <stdexec::__decays_to<bulk_sender> Self, class Env>
497-
STDEXEC_EXPLICIT_THIS_BEGIN(auto get_completion_signatures)(this Self&&, Env&&)
498-
-> completion_signatures<Self, Env> {
497+
static consteval auto get_completion_signatures() -> completion_signatures<Self, Env> {
499498
return {};
500499
}
501-
STDEXEC_EXPLICIT_THIS_END(get_completion_signatures)
502500

503501
auto get_env() const noexcept -> stdexec::env_of_t<const Sender&> {
504502
return stdexec::get_env(sndr_);

include/exec/__detail/__basic_sequence.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ namespace exec {
6565

6666
template <STDEXEC::__decays_to_derived_from<__seqexpr> _Self, class... _Env>
6767
static consteval auto get_completion_signatures() {
68+
using T = decltype(__tag_t::template get_completion_signatures<_Self, _Env...>());
69+
static_assert(STDEXEC::__ok<T> || STDEXEC::__merror<T>,
70+
"Sequence expression's get_completion_signatures returned an invalid type");
6871
return __tag_t::template get_completion_signatures<_Self, _Env...>();
6972
}
7073

include/exec/any_sender_of.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,11 +1233,9 @@ namespace exec {
12331233

12341234
template <STDEXEC::__decays_to_derived_from<any_sender> _Self, class... _Env>
12351235
requires(__any::__satisfies_receiver_query<decltype(_ReceiverQueries), _Env...> && ...)
1236-
STDEXEC_EXPLICIT_THIS_BEGIN(auto get_completion_signatures)(this _Self&&, _Env&&...) noexcept
1237-
-> __sender_base::completion_signatures {
1236+
static consteval auto get_completion_signatures() -> __sender_base::completion_signatures {
12381237
return {};
12391238
}
1240-
STDEXEC_EXPLICIT_THIS_END(get_completion_signatures)
12411239

12421240
template <STDEXEC::receiver_of<_Completions> _Receiver>
12431241
auto connect(_Receiver __rcvr) && -> STDEXEC::connect_result_t<__sender_base, _Receiver> {

include/exec/async_scope.hpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,10 @@ namespace exec {
131131
STDEXEC_EXPLICIT_THIS_END(connect)
132132

133133
template <__decays_to<__t> _Self, class... _Env>
134-
STDEXEC_EXPLICIT_THIS_BEGIN(auto get_completion_signatures)(this _Self&&, _Env&&...)
134+
static consteval auto get_completion_signatures()
135135
-> __completion_signatures_of_t<__copy_cvref_t<_Self, _Constrained>, __env_t<_Env>...> {
136136
return {};
137137
}
138-
STDEXEC_EXPLICIT_THIS_END(get_completion_signatures)
139138

140139
const __impl* __scope_;
141140
STDEXEC_ATTRIBUTE(no_unique_address) _Constrained __c_;
@@ -278,11 +277,10 @@ namespace exec {
278277
STDEXEC_EXPLICIT_THIS_END(connect)
279278

280279
template <__decays_to<__t> _Self, class... _Env>
281-
STDEXEC_EXPLICIT_THIS_BEGIN(auto get_completion_signatures)(this _Self&&, _Env&&...)
280+
static consteval auto get_completion_signatures()
282281
-> __completion_signatures_of_t<__copy_cvref_t<_Self, _Constrained>, __env_t<_Env>...> {
283282
return {};
284283
}
285-
STDEXEC_EXPLICIT_THIS_END(get_completion_signatures)
286284
};
287285
};
288286

@@ -684,11 +682,9 @@ namespace exec {
684682
STDEXEC_EXPLICIT_THIS_END(connect)
685683

686684
template <__decays_to<__t> _Self, class... _OtherEnv>
687-
STDEXEC_EXPLICIT_THIS_BEGIN(auto get_completion_signatures)(this _Self&&, _OtherEnv&&...)
688-
-> __completions_t<_Self> {
685+
static consteval auto get_completion_signatures() -> __completions_t<_Self> {
689686
return {};
690687
}
691-
STDEXEC_EXPLICIT_THIS_END(get_completion_signatures)
692688

693689
private:
694690
friend struct async_scope;

include/exec/at_coroutine_exit.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,9 @@ namespace exec {
9191
}
9292

9393
template <__same_as<__t> _Self, class... _Env>
94-
STDEXEC_EXPLICIT_THIS_BEGIN(auto get_completion_signatures)(this _Self&&, _Env&&...)
95-
-> __completions_t<_Env...> {
94+
static consteval auto get_completion_signatures() -> __completions_t<_Env...> {
9695
return {};
9796
}
98-
STDEXEC_EXPLICIT_THIS_END(get_completion_signatures)
9997

10098
auto get_env() const noexcept -> env_of_t<_Sender> {
10199
return STDEXEC::get_env(__sender_);

include/exec/completion_signatures.hpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ namespace exec {
3939
detail::normalize(static_cast<Sigs*>(nullptr))...));
4040
} // namespace detail
4141

42+
///////////////////////////////////////////////////////////////////////////////////////////////////
43+
// get_child_completion_signatures
44+
template <STDEXEC::sender _Parent, STDEXEC::sender _Child, class... _Env>
45+
[[nodiscard]]
46+
consteval auto get_child_completion_signatures() {
47+
return STDEXEC::get_completion_signatures<
48+
STDEXEC::__copy_cvref_t<_Parent, _Child>,
49+
STDEXEC::__fwd_env_t<_Env>...
50+
>();
51+
}
52+
4253
//! Creates a compile-time completion signatures type from explicit and deduced signature types.
4354
//!
4455
//! This function is a compile-time helper that constructs a completion signatures type
@@ -213,8 +224,8 @@ namespace exec {
213224
ErrorFn error_fn = {},
214225
StoppedFn stopped_fn = {},
215226
ExtraSigs = {}) {
216-
STDEXEC_COMPLSIGS_LET(auto(completions) = Completions{}) {
217-
STDEXEC_COMPLSIGS_LET(auto(extra_sigs) = ExtraSigs{}) {
227+
STDEXEC_COMPLSIGS_LET(completions, Completions{}) {
228+
STDEXEC_COMPLSIGS_LET(extra_sigs, ExtraSigs{}) {
218229
detail::_transform_one<ValueFn, ErrorFn, StoppedFn> tfx1{value_fn, error_fn, stopped_fn};
219230
return concat_completion_signatures(
220231
completions.__apply(detail::_transform_all_fn{tfx1}), extra_sigs);

include/exec/env.hpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ namespace exec {
126126
}
127127
STDEXEC_EXPLICIT_THIS_END(connect)
128128

129-
template <class _Env>
130-
constexpr auto get_completion_signatures(_Env&&) -> __completions_t<_Env> {
129+
template <class, class _Env>
130+
static consteval auto get_completion_signatures() -> __completions_t<_Env> {
131131
return {};
132132
}
133133
};
@@ -166,12 +166,10 @@ namespace exec {
166166
}
167167

168168
template <__decays_to<__t> _Self, class... _Env>
169-
constexpr STDEXEC_EXPLICIT_THIS_BEGIN(
170-
auto get_completion_signatures)(this _Self&&, _Env&&...)
169+
static consteval auto get_completion_signatures()
171170
-> __completion_signatures_of_t<__copy_cvref_t<_Self, _Sender>, _Env...> {
172171
return {};
173172
}
174-
STDEXEC_EXPLICIT_THIS_END(get_completion_signatures)
175173

176174
template <__decays_to<__t> _Self, class _Receiver>
177175
requires sender_in<__copy_cvref_t<_Self, _Sender>, env_of_t<_Receiver>>

0 commit comments

Comments
 (0)