Skip to content

Commit 21db1df

Browse files
committed
change the common domain computation to use std::common_type
1 parent c3f90d4 commit 21db1df

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

include/exec/static_thread_pool.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ namespace exec {
261261
}
262262

263263
public:
264-
struct domain {
264+
struct domain : stdexec::default_domain {
265265
// For eager customization
266266
template <sender_expr_for<bulk_t> Sender>
267267
auto transform_sender(Sender&& sndr) const noexcept {

include/stdexec/__detail/__domain.hpp

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "__meta.hpp"
2525

2626
#include "../functional.hpp"
27+
#include "__utility.hpp"
2728

2829
namespace stdexec {
2930

@@ -254,20 +255,15 @@ namespace stdexec {
254255

255256
namespace __domain {
256257
struct __common_domain_fn {
257-
static auto __common_domain() noexcept -> default_domain {
258-
return {};
259-
}
260-
261-
template <class _Domain, class... _OtherDomains>
262-
requires __all_of<_Domain, _OtherDomains...>
263-
static auto __common_domain(_Domain __domain, _OtherDomains...) noexcept -> _Domain {
264-
return static_cast<_Domain&&>(__domain);
265-
}
266-
267258
template <class... _Domains>
268-
static auto __common_domain(_Domains...) noexcept //
269-
-> __if_c<__one_of<dependent_domain, _Domains...>, dependent_domain, __none_such> {
270-
return {};
259+
static auto __common_domain(_Domains...) noexcept {
260+
if constexpr (__one_of<dependent_domain, _Domains...>) {
261+
return dependent_domain();
262+
} else if constexpr (stdexec::__mvalid<std::common_type_t, _Domains...>) {
263+
return std::common_type_t<_Domains...>();
264+
} else {
265+
return __none_such();
266+
}
271267
}
272268

273269
auto operator()(__ignore, __ignore, const auto&... __sndrs) const noexcept {

0 commit comments

Comments
 (0)