Skip to content

Commit d0b7f07

Browse files
author
Hackathon User
committed
Modernize PR 7240: Use C++20 requires clause and remove redundant executor includes
1 parent 812850e commit d0b7f07

4 files changed

Lines changed: 13 additions & 61 deletions

File tree

libs/core/executors/include/hpx/executors/executor_scheduler.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <hpx/modules/execution.hpp>
1515
#include <hpx/modules/execution_base.hpp>
1616

17+
#include <concepts>
1718
#include <exception>
1819
#include <type_traits>
1920
#include <utility>
@@ -109,9 +110,8 @@ namespace hpx::execution::experimental {
109110

110111
constexpr executor_scheduler() = default;
111112

112-
template <typename Exec,
113-
typename = std::enable_if_t<
114-
!std::is_same_v<std::decay_t<Exec>, executor_scheduler>>>
113+
template <typename Exec>
114+
requires(!std::is_same_v<std::decay_t<Exec>, executor_scheduler>)
115115
explicit executor_scheduler(Exec&& exec)
116116
: exec_(HPX_FORWARD(Exec, exec))
117117
{

libs/core/executors/include/hpx/executors/executor_scheduler_bulk.hpp

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88

99
#include <hpx/config.hpp>
1010

11-
#if defined(HPX_HAVE_STDEXEC)
1211
#include <hpx/execution_base/stdexec_forward.hpp>
13-
#endif
1412

1513
#include <hpx/execution/algorithms/bulk.hpp>
1614
#include <hpx/execution_base/completion_scheduler.hpp>
@@ -82,7 +80,6 @@ namespace hpx::execution::experimental {
8280
HPX_NO_UNIQUE_ADDRESS std::decay_t<Shape> shape_;
8381
HPX_NO_UNIQUE_ADDRESS std::decay_t<F> f_;
8482

85-
#if defined(HPX_HAVE_STDEXEC)
8683
using sender_concept = hpx::execution::experimental::sender_t;
8784

8885
#if defined(HPX_CLANG_VERSION)
@@ -142,48 +139,7 @@ namespace hpx::execution::experimental {
142139
{
143140
return env{s.sender_, s.exec_};
144141
}
145-
#else
146-
template <typename Env>
147-
struct generate_completion_signatures
148-
{
149-
template <template <typename...> typename Tuple,
150-
template <typename...> typename Variant>
151-
using value_types =
152-
value_types_of_t<Sender, Env, Tuple, Variant>;
153-
154-
template <template <typename...> typename Variant>
155-
using error_types = hpx::util::detail::unique_concat_t<
156-
error_types_of_t<Sender, Env, Variant>,
157-
Variant<std::exception_ptr>>;
158-
159-
static constexpr bool sends_stopped =
160-
sends_stopped_of_v<Sender, Env>;
161-
};
162-
163-
template <typename Env>
164-
friend auto tag_invoke(
165-
hpx::execution::experimental::get_completion_signatures_t,
166-
executor_bulk_sender const&, Env)
167-
-> generate_completion_signatures<Env>;
168-
169-
template <typename CPO>
170-
friend constexpr auto tag_invoke(
171-
hpx::execution::experimental::get_completion_scheduler_t<CPO>
172-
tag,
173-
executor_bulk_sender const& s)
174-
{
175-
return tag(s.sender_);
176-
}
177142

178-
friend constexpr auto tag_invoke(
179-
hpx::execution::experimental::get_completion_scheduler_t<
180-
hpx::execution::experimental::set_value_t>,
181-
executor_bulk_sender const& s)
182-
{
183-
return hpx::execution::experimental::executor_scheduler<
184-
Executor>{s.exec_};
185-
}
186-
#endif
187143

188144
template <typename Receiver>
189145
friend auto tag_invoke(connect_t,

libs/core/executors/include/hpx/executors/parallel_executor.hpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
#include <hpx/executors/detail/hierarchical_spawning.hpp>
1414
#include <hpx/executors/detail/index_queue_spawning.hpp>
1515
#include <hpx/executors/execution_policy_mappings.hpp>
16-
#include <hpx/executors/executor_scheduler.hpp>
17-
#include <hpx/executors/executor_scheduler_bulk.hpp>
1816
#include <hpx/executors/fwd/executor_scheduler_fwd.hpp>
1917
#include <hpx/modules/allocator_support.hpp>
2018
#include <hpx/modules/async_base.hpp>
@@ -675,13 +673,13 @@ namespace hpx::execution {
675673
}
676674
}
677675

678-
friend hpx::execution::experimental::executor_scheduler<
679-
parallel_policy_executor>
676+
template <typename Exec = parallel_policy_executor>
677+
requires std::is_same_v<Exec, parallel_policy_executor>
678+
friend hpx::execution::experimental::executor_scheduler<Exec>
680679
tag_invoke(hpx::execution::experimental::get_scheduler_t,
681-
parallel_policy_executor const& exec)
680+
Exec const& exec)
682681
{
683-
return hpx::execution::experimental::executor_scheduler<
684-
parallel_policy_executor>(exec);
682+
return hpx::execution::experimental::executor_scheduler<Exec>(exec);
685683
}
686684
/// \endcond
687685

libs/core/executors/include/hpx/executors/sequenced_executor.hpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
#include <hpx/config.hpp>
1212
#include <hpx/executors/execution_policy_mappings.hpp>
13-
#include <hpx/executors/executor_scheduler.hpp>
14-
#include <hpx/executors/executor_scheduler_bulk.hpp>
1513
#include <hpx/executors/fwd/executor_scheduler_fwd.hpp>
1614
#include <hpx/executors/parallel_executor.hpp>
1715
#include <hpx/modules/errors.hpp>
@@ -239,13 +237,13 @@ namespace hpx::execution {
239237
#endif
240238
}
241239

242-
friend hpx::execution::experimental::executor_scheduler<
243-
sequenced_executor>
240+
template <typename Exec = sequenced_executor>
241+
requires std::is_same_v<Exec, sequenced_executor>
242+
friend hpx::execution::experimental::executor_scheduler<Exec>
244243
tag_invoke(hpx::execution::experimental::get_scheduler_t,
245-
sequenced_executor const& exec)
244+
Exec const& exec)
246245
{
247-
return hpx::execution::experimental::executor_scheduler<
248-
sequenced_executor>(exec);
246+
return hpx::execution::experimental::executor_scheduler<Exec>(exec);
249247
}
250248

251249
private:

0 commit comments

Comments
 (0)