Skip to content

Commit 236dd38

Browse files
committed
migrate most senders to use static consteval version of get_completion_signatures
1 parent 970dbac commit 236dd38

Some content is hidden

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

45 files changed

+212
-237
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
@@ -125,11 +125,10 @@ namespace exec {
125125
STDEXEC_EXPLICIT_THIS_END(connect)
126126

127127
template <__decays_to<__t> _Self, class... _Env>
128-
STDEXEC_EXPLICIT_THIS_BEGIN(auto get_completion_signatures)(this _Self&&, _Env&&...)
128+
static consteval auto get_completion_signatures()
129129
-> __completion_signatures_of_t<__copy_cvref_t<_Self, _Constrained>, __env_t<_Env>...> {
130130
return {};
131131
}
132-
STDEXEC_EXPLICIT_THIS_END(get_completion_signatures)
133132

134133
const __impl* __scope_;
135134
STDEXEC_ATTRIBUTE(no_unique_address) _Constrained __c_;
@@ -266,11 +265,10 @@ namespace exec {
266265
STDEXEC_EXPLICIT_THIS_END(connect)
267266

268267
template <__decays_to<__t> _Self, class... _Env>
269-
STDEXEC_EXPLICIT_THIS_BEGIN(auto get_completion_signatures)(this _Self&&, _Env&&...)
268+
static consteval auto get_completion_signatures()
270269
-> __completion_signatures_of_t<__copy_cvref_t<_Self, _Constrained>, __env_t<_Env>...> {
271270
return {};
272271
}
273-
STDEXEC_EXPLICIT_THIS_END(get_completion_signatures)
274272
};
275273
};
276274

@@ -672,11 +670,9 @@ namespace exec {
672670
STDEXEC_EXPLICIT_THIS_END(connect)
673671

674672
template <__decays_to<__t> _Self, class... _OtherEnv>
675-
STDEXEC_EXPLICIT_THIS_BEGIN(auto get_completion_signatures)(this _Self&&, _OtherEnv&&...)
676-
-> __completions_t<_Self> {
673+
static consteval auto get_completion_signatures() -> __completions_t<_Self> {
677674
return {};
678675
}
679-
STDEXEC_EXPLICIT_THIS_END(get_completion_signatures)
680676

681677
private:
682678
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/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>>

include/exec/finally.hpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,18 +280,15 @@ namespace exec {
280280
STDEXEC_EXPLICIT_THIS_END(connect)
281281

282282
template <__decays_to<__t> _Self, class... _Env>
283-
STDEXEC_EXPLICIT_THIS_BEGIN(
284-
auto get_completion_signatures)(this _Self&&, _Env&&...) noexcept
283+
static consteval auto get_completion_signatures()
285284
-> __completion_signatures_t<__copy_cvref_t<_Self, _InitialSender>, _FinalSender, _Env...> {
286285
return {};
287286
}
288287
template <__decays_to<__t> _Self, class... _Env>
289288
requires(!__decay_copyable<__copy_cvref_t<_Self, _FinalSender>>)
290-
STDEXEC_EXPLICIT_THIS_BEGIN(
291-
auto get_completion_signatures)(this _Self&&, _Env&&...) noexcept {
292-
return _ERROR_<_SENDER_TYPE_IS_NOT_COPYABLE_, _WITH_SENDER_<_FinalSender>>{};
289+
static consteval auto get_completion_signatures() {
290+
return stdexec::__invalid_completion_signature<_SENDER_TYPE_IS_NOT_COPYABLE_, _WITH_SENDER_<_FinalSender>>();
293291
}
294-
STDEXEC_EXPLICIT_THIS_END(get_completion_signatures)
295292
};
296293
};
297294

include/exec/fork_join.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ namespace exec {
102102
const Variant* _results_;
103103
};
104104

105-
template <class... _Env>
105+
template <class _Self, class... _Env>
106106
STDEXEC_ATTRIBUTE(host, device)
107-
auto get_completion_signatures(_Env&&...) const noexcept {
107+
static consteval auto get_completion_signatures() {
108108
return stdexec::__mapply<stdexec::__qq<_cache_sndr_completions_t>, Variant>{};
109109
}
110110

@@ -254,7 +254,7 @@ namespace exec {
254254

255255
template <class Self, class... Env>
256256
STDEXEC_ATTRIBUTE(host, device)
257-
STDEXEC_EXPLICIT_THIS_BEGIN(auto get_completion_signatures)(this Self&&, Env&&...) noexcept {
257+
static consteval auto get_completion_signatures() {
258258
using namespace stdexec;
259259
using _domain_t = stdexec::__completion_domain_of_t<set_value_t, Sndr, Env...>;
260260
using _child_t = __copy_cvref_t<Self, Sndr>;
@@ -273,7 +273,6 @@ namespace exec {
273273
return __completion_signatures_of_t<_sndr_t, __fwd_env_t<Env>...>{};
274274
}
275275
}
276-
STDEXEC_EXPLICIT_THIS_END(get_completion_signatures)
277276

278277
template <class Rcvr>
279278
STDEXEC_ATTRIBUTE(host, device)

0 commit comments

Comments
 (0)