From ba7fcf25917193b3d1208eeed090e4e733120c13 Mon Sep 17 00:00:00 2001 From: Mikael Simberg Date: Mon, 11 Nov 2024 11:15:34 +0100 Subject: [PATCH] Replace PIKA_FORWARD with std::forward again --- .../allocator_support/aligned_allocator.hpp | 2 +- .../allocator_support/internal_allocator.hpp | 2 +- .../pika/async_cuda/cuda_scheduler.hpp | 6 +- .../pika/async_cuda/cuda_scheduler_bulk.hpp | 10 +-- .../pika/async_cuda/then_with_stream.hpp | 80 +++++++++---------- .../include/pika/async_mpi/dispatch_mpi.hpp | 16 ++-- .../include/pika/async_mpi/mpi_helpers.hpp | 4 +- .../include/pika/async_mpi/transform_mpi.hpp | 8 +- .../include/pika/async_mpi/trigger_mpi.hpp | 12 +-- .../pika/concurrency/concurrentqueue.hpp | 28 +++---- libs/pika/config/CMakeLists.txt | 1 - libs/pika/config/include/pika/config.hpp | 1 - .../config/include/pika/config/forward.hpp | 13 --- .../pika/coroutines/detail/coroutine_self.hpp | 2 +- .../datastructures/detail/small_vector.hpp | 4 +- .../pika/datastructures/member_pack.hpp | 8 +- .../include/pika/errors/exception_info.hpp | 28 +++---- .../pika/execution/algorithms/bulk.hpp | 28 +++---- .../execution/algorithms/continues_on.hpp | 8 +- .../algorithms/detail/partial_algorithm.hpp | 4 +- .../algorithms/drop_operation_state.hpp | 14 ++-- .../pika/execution/algorithms/drop_value.hpp | 8 +- .../execution/algorithms/ensure_started.hpp | 30 +++---- .../pika/execution/algorithms/execute.hpp | 2 +- .../pika/execution/algorithms/just.hpp | 14 ++-- .../pika/execution/algorithms/let_error.hpp | 16 ++-- .../pika/execution/algorithms/let_value.hpp | 22 ++--- .../execution/algorithms/require_started.hpp | 26 +++--- .../execution/algorithms/schedule_from.hpp | 28 +++---- .../pika/execution/algorithms/split.hpp | 26 +++--- .../pika/execution/algorithms/split_tuple.hpp | 18 ++--- .../execution/algorithms/start_detached.hpp | 4 +- .../pika/execution/algorithms/sync_wait.hpp | 6 +- .../pika/execution/algorithms/then.hpp | 20 ++--- .../execution/algorithms/transfer_just.hpp | 2 +- .../algorithms/transfer_when_all.hpp | 2 +- .../pika/execution/algorithms/unpack.hpp | 10 +-- .../pika/execution/algorithms/when_all.hpp | 34 ++++---- .../execution/algorithms/when_all_vector.hpp | 12 +-- .../pika/execution_base/any_sender.hpp | 40 +++++----- .../pika/executors/std_thread_scheduler.hpp | 6 +- .../pika/executors/thread_pool_scheduler.hpp | 16 ++-- .../executors/thread_pool_scheduler_bulk.hpp | 28 +++---- .../include/pika/functional/bind.hpp | 20 ++--- .../include/pika/functional/bind_back.hpp | 16 ++-- .../include/pika/functional/bind_front.hpp | 16 ++-- .../include/pika/functional/deferred_call.hpp | 8 +- .../pika/functional/detail/basic_function.hpp | 4 +- .../detail/vtable/callable_vtable.hpp | 2 +- .../include/pika/functional/function.hpp | 4 +- .../include/pika/functional/invoke.hpp | 4 +- .../include/pika/functional/one_shot.hpp | 6 +- .../pika/functional/unique_function.hpp | 4 +- libs/pika/ini/src/ini.cpp | 10 +-- .../pika/iterator_support/zip_iterator.hpp | 4 +- .../pika/properties/include/pika/property.hpp | 12 +-- .../include/pika/string_util/from_string.hpp | 4 +- .../include/pika/string_util/split.hpp | 4 +- .../pika/synchronization/async_rw_mutex.hpp | 18 ++--- .../include/pika/synchronization/once.hpp | 2 +- .../pika/synchronization/stop_token.hpp | 16 ++-- .../include/pika/functional/detail/invoke.hpp | 22 ++--- .../functional/detail/tag_fallback_invoke.hpp | 31 +++---- .../functional/detail/tag_priority_invoke.hpp | 26 +++--- .../include/pika/functional/tag_invoke.hpp | 18 ++--- .../include/pika/threading/jthread.hpp | 28 +++---- .../include/pika/threading/thread.hpp | 8 +- .../threading_base/annotated_function.hpp | 10 +-- .../pika/threading_base/register_thread.hpp | 4 +- .../pika/threading_base/thread_init_data.hpp | 2 +- .../type_support/detail/with_result_of.hpp | 8 +- 71 files changed, 468 insertions(+), 492 deletions(-) delete mode 100644 libs/pika/config/include/pika/config/forward.hpp diff --git a/libs/pika/allocator_support/include/pika/allocator_support/aligned_allocator.hpp b/libs/pika/allocator_support/include/pika/allocator_support/aligned_allocator.hpp index 58dd47e99..6c2942623 100644 --- a/libs/pika/allocator_support/include/pika/allocator_support/aligned_allocator.hpp +++ b/libs/pika/allocator_support/include/pika/allocator_support/aligned_allocator.hpp @@ -147,7 +147,7 @@ namespace pika::detail { template void construct(U* p, Args&&... args) { - ::new ((void*) p) U(PIKA_FORWARD(Args, args)...); + ::new ((void*) p) U(std::forward(args)...); } template diff --git a/libs/pika/allocator_support/include/pika/allocator_support/internal_allocator.hpp b/libs/pika/allocator_support/include/pika/allocator_support/internal_allocator.hpp index 38b773055..3816b2739 100644 --- a/libs/pika/allocator_support/include/pika/allocator_support/internal_allocator.hpp +++ b/libs/pika/allocator_support/include/pika/allocator_support/internal_allocator.hpp @@ -79,7 +79,7 @@ namespace pika::detail { template void construct(U* p, Args&&... args) { - ::new ((void*) p) U(PIKA_FORWARD(Args, args)...); + ::new ((void*) p) U(std::forward( args)...); } template diff --git a/libs/pika/async_cuda/include/pika/async_cuda/cuda_scheduler.hpp b/libs/pika/async_cuda/include/pika/async_cuda/cuda_scheduler.hpp index 3268909c6..ba08db09c 100644 --- a/libs/pika/async_cuda/include/pika/async_cuda/cuda_scheduler.hpp +++ b/libs/pika/async_cuda/include/pika/async_cuda/cuda_scheduler.hpp @@ -87,7 +87,7 @@ namespace pika::cuda::experimental { template operation_state(cuda_scheduler scheduler, Receiver_&& receiver) : scheduler(std::move(scheduler)) - , receiver(PIKA_FORWARD(Receiver_, receiver)) + , receiver(std::forward(receiver)) { } operation_state(operation_state&&) = delete; @@ -131,14 +131,14 @@ namespace pika::cuda::experimental { friend operation_state tag_invoke(pika::execution::experimental::connect_t, cuda_scheduler_sender&& s, Receiver&& receiver) { - return {std::move(s.scheduler), PIKA_FORWARD(Receiver, receiver)}; + return {std::move(s.scheduler), std::forward(receiver)}; } template friend operation_state tag_invoke(pika::execution::experimental::connect_t, cuda_scheduler_sender const& s, Receiver&& receiver) { - return {s.scheduler, PIKA_FORWARD(Receiver, receiver)}; + return {s.scheduler, std::forward(receiver)}; } struct env diff --git a/libs/pika/async_cuda/include/pika/async_cuda/cuda_scheduler_bulk.hpp b/libs/pika/async_cuda/include/pika/async_cuda/cuda_scheduler_bulk.hpp index eda15d083..1f9647979 100644 --- a/libs/pika/async_cuda/include/pika/async_cuda/cuda_scheduler_bulk.hpp +++ b/libs/pika/async_cuda/include/pika/async_cuda/cuda_scheduler_bulk.hpp @@ -36,14 +36,14 @@ namespace pika::cuda::experimental { template auto shape_size_impl(std::false_type, Shape&& shape) { - return pika::util::size(PIKA_FORWARD(Shape, shape)); + return pika::util::size(std::forward(shape)); } template auto shape_size(Shape&& shape) { return shape_size_impl( - std::is_integral>{}, PIKA_FORWARD(Shape, shape)); + std::is_integral>{}, std::forward(shape)); } #if defined(PIKA_COMPUTE_CODE) @@ -65,7 +65,7 @@ namespace pika::cuda::experimental { PIKA_DEVICE auto shape_dereference(Shape&& shape, int i) { return shape_dereference_impl( - std::is_integral>{}, PIKA_FORWARD(Shape, shape), i); + std::is_integral>{}, std::forward(shape), i); } template @@ -142,7 +142,7 @@ namespace pika::cuda::experimental { decltype(auto) tag_invoke(pika::execution::experimental::bulk_t, cuda_scheduler, Sender&& sender, Shape&& shape, F&& f) { - return then_with_stream(PIKA_FORWARD(Sender, sender), - detail::bulk_launcher{PIKA_FORWARD(Shape, shape), PIKA_FORWARD(F, f)}); + return then_with_stream(std::forward(sender), + detail::bulk_launcher{std::forward(shape), std::forward(f)}); } } // namespace pika::cuda::experimental diff --git a/libs/pika/async_cuda/include/pika/async_cuda/then_with_stream.hpp b/libs/pika/async_cuda/include/pika/async_cuda/then_with_stream.hpp index 34b046a19..4f04ad7bf 100644 --- a/libs/pika/async_cuda/include/pika/async_cuda/then_with_stream.hpp +++ b/libs/pika/async_cuda/include/pika/async_cuda/then_with_stream.hpp @@ -37,21 +37,21 @@ namespace pika::cuda::experimental::then_with_stream_detail { template auto invoke_with_thread_local_cublas_handle(cuda_scheduler& sched, cuda_stream const& stream, - cublasPointerMode_t pointer_mode, F&& f, Ts&&... ts) - -> decltype(PIKA_INVOKE( - PIKA_FORWARD(F, f), std::declval(), PIKA_FORWARD(Ts, ts)...)) + cublasPointerMode_t pointer_mode, F&& f, + Ts&&... ts) -> decltype(PIKA_INVOKE(std::forward(f), std::declval(), + std::forward(ts)...)) { auto locked_handle = sched.get_cublas_handle(stream, pointer_mode); - return PIKA_INVOKE(PIKA_FORWARD(F, f), locked_handle.get().get(), PIKA_FORWARD(Ts, ts)...); + return PIKA_INVOKE(std::forward(f), locked_handle.get().get(), std::forward(ts)...); } template auto invoke_with_thread_local_cusolver_handle(cuda_scheduler& sched, cuda_stream const& stream, - F&& f, Ts&&... ts) -> decltype(PIKA_INVOKE(PIKA_FORWARD(F, f), - std::declval(), PIKA_FORWARD(Ts, ts)...)) + F&& f, Ts&&... ts) -> decltype(PIKA_INVOKE(std::forward(f), + std::declval(), std::forward(ts)...)) { auto locked_handle = sched.get_cusolver_handle(stream); - return PIKA_INVOKE(PIKA_FORWARD(F, f), locked_handle.get().get(), PIKA_FORWARD(Ts, ts)...); + return PIKA_INVOKE(std::forward(f), locked_handle.get().get(), std::forward(ts)...); } template @@ -63,11 +63,11 @@ namespace pika::cuda::experimental::then_with_stream_detail { if (status == whip::success) { - pika::execution::experimental::set_value(PIKA_FORWARD(R, r), PIKA_FORWARD(Ts, ts)...); + pika::execution::experimental::set_value(std::forward(r), std::forward(ts)...); } else { - pika::execution::experimental::set_error(PIKA_FORWARD(R, r), + pika::execution::experimental::set_error(std::forward(r), std::make_exception_ptr(pika::exception(pika::error::unknown_error, fmt::format( "Getting event after CUDA stream transform failed with status {} ({})", @@ -137,8 +137,8 @@ namespace pika::cuda::experimental::then_with_stream_detail { template then_with_cuda_stream_sender_type(Sender_&& sender, F_&& f, cuda_scheduler sched) - : sender(PIKA_FORWARD(Sender_, sender)) - , f(PIKA_FORWARD(F_, f)) + : sender(std::forward(sender)) + , f(std::forward(f)) , sched(std::move(sched)) { } @@ -239,7 +239,7 @@ namespace pika::cuda::experimental::then_with_stream_detail { then_with_cuda_stream_receiver&& r, Error&& error) noexcept { pika::execution::experimental::set_error( - std::move(r.op_state.receiver), PIKA_FORWARD(Error, error)); + std::move(r.op_state.receiver), std::forward(error)); } friend void tag_invoke(pika::execution::experimental::set_stopped_t, @@ -256,7 +256,7 @@ namespace pika::cuda::experimental::then_with_stream_detail { pika::detail::try_catch_exception_ptr( [&]() mutable { using ts_element_type = std::tuple...>; - op_state.ts.template emplace(PIKA_FORWARD(Ts, ts)...); + op_state.ts.template emplace(std::forward(ts)...); [[maybe_unused]] auto& t = std::get(op_state.ts); if (!op_state.stream) @@ -389,8 +389,8 @@ namespace pika::cuda::experimental::then_with_stream_detail { // matches the argument list"). template friend auto tag_invoke(pika::execution::experimental::set_value_t, - then_with_cuda_stream_receiver&& r, Ts&&... ts) noexcept - -> decltype(r.set_value(PIKA_FORWARD(Ts, ts)...)) + then_with_cuda_stream_receiver&& r, + Ts&&... ts) noexcept -> decltype(r.set_value(std::forward(ts)...)) { // nvcc fails to compile this with std::forward(ts)... or // static_cast(ts)... so we explicitly use @@ -398,7 +398,7 @@ namespace pika::cuda::experimental::then_with_stream_detail { #if defined(PIKA_HAVE_CUDA) r.set_value(static_cast(ts)...); #else - r.set_value(PIKA_FORWARD(Ts, ts)...); + r.set_value(std::forward(ts)...); #endif } @@ -481,11 +481,11 @@ namespace pika::cuda::experimental::then_with_stream_detail { template operation_state(Receiver_&& receiver, F_&& f, cuda_scheduler sched, Sender_&& sender) - : receiver(PIKA_FORWARD(Receiver_, receiver)) - , f(PIKA_FORWARD(F_, f)) + : receiver(std::forward(receiver)) + , f(std::forward(f)) , sched(std::move(sched)) , op_state(pika::execution::experimental::connect( - PIKA_FORWARD(Sender_, sender), then_with_cuda_stream_receiver{*this})) + std::forward(sender), then_with_cuda_stream_receiver{*this})) { } @@ -500,7 +500,7 @@ namespace pika::cuda::experimental::then_with_stream_detail { friend auto tag_invoke(pika::execution::experimental::connect_t, then_with_cuda_stream_sender_type&& s, Receiver&& receiver) { - return operation_state(PIKA_FORWARD(Receiver, receiver), std::move(s.f), + return operation_state(std::forward(receiver), std::move(s.f), std::move(s.sched), std::move(s.sender)); } @@ -509,7 +509,7 @@ namespace pika::cuda::experimental::then_with_stream_detail { then_with_cuda_stream_sender_type const& s, Receiver&& receiver) { return operation_state( - PIKA_FORWARD(Receiver, receiver), s.f, s.sched, s.sender); + std::forward(receiver), s.f, s.sched, s.sender); } friend auto tag_invoke(pika::execution::experimental::get_env_t, @@ -532,7 +532,7 @@ namespace pika::cuda::experimental::then_with_stream_detail { "cuda_scheduler"); return then_with_stream_detail::then_with_cuda_stream_sender{ - PIKA_FORWARD(Sender, sender), PIKA_FORWARD(F, f), std::move(completion_sched)}; + std::forward(sender), std::forward(f), std::move(completion_sched)}; } // This is a wrapper for functions that expect a cudaStream_t in the last @@ -546,11 +546,11 @@ namespace pika::cuda::experimental::then_with_stream_detail { auto operator()(cuda_scheduler&, cuda_stream const& stream, Ts&&... ts) // nvcc does not compile this correctly with noexcept(...) #if defined(PIKA_CLANG_VERSION) - noexcept(noexcept(PIKA_INVOKE(f, PIKA_FORWARD(Ts, ts)..., stream.get()))) + noexcept(noexcept(PIKA_INVOKE(f, std::forward(ts)..., stream.get()))) #endif - -> decltype(PIKA_INVOKE(f, PIKA_FORWARD(Ts, ts)..., stream.get())) + -> decltype(PIKA_INVOKE(f, std::forward(ts)..., stream.get())) { - return PIKA_INVOKE(f, PIKA_FORWARD(Ts, ts)..., stream.get()); + return PIKA_INVOKE(f, std::forward(ts)..., stream.get()); } }; @@ -567,13 +567,13 @@ namespace pika::cuda::experimental::then_with_stream_detail { // nvcc does not compile this correctly with noexcept(...) #if defined(PIKA_CLANG_VERSION) noexcept(noexcept(invoke_with_thread_local_cublas_handle( - sched, stream, pointer_mode, f, PIKA_FORWARD(Ts, ts)...))) + sched, stream, pointer_mode, f, std::forward(ts)...))) #endif -> decltype(invoke_with_thread_local_cublas_handle( - sched, stream, pointer_mode, f, PIKA_FORWARD(Ts, ts)...)) + sched, stream, pointer_mode, f, std::forward(ts)...)) { return invoke_with_thread_local_cublas_handle( - sched, stream, pointer_mode, f, PIKA_FORWARD(Ts, ts)...); + sched, stream, pointer_mode, f, std::forward(ts)...); } }; @@ -589,13 +589,13 @@ namespace pika::cuda::experimental::then_with_stream_detail { // nvcc does not compile this correctly with noexcept(...) #if defined(PIKA_CLANG_VERSION) noexcept(noexcept(invoke_with_thread_local_cusolver_handle( - sched, stream, f, PIKA_FORWARD(Ts, ts)...))) + sched, stream, f, std::forward(ts)...))) #endif -> decltype(invoke_with_thread_local_cusolver_handle( - sched, stream, f, PIKA_FORWARD(Ts, ts)...)) + sched, stream, f, std::forward(ts)...)) { return invoke_with_thread_local_cusolver_handle( - sched, stream, f, PIKA_FORWARD(Ts, ts)...); + sched, stream, f, std::forward(ts)...); } }; } // namespace pika::cuda::experimental::then_with_stream_detail @@ -623,15 +623,15 @@ namespace pika::cuda::experimental { template constexpr PIKA_FORCEINLINE auto PIKA_STATIC_CALL_OPERATOR(Sender&& sender, F&& f) { - return then_with_stream_detail::then_with_cuda_stream(PIKA_FORWARD(Sender, sender), - then_with_stream_detail::cuda_stream_callable{PIKA_FORWARD(F, f)}); + return then_with_stream_detail::then_with_cuda_stream(std::forward(sender), + then_with_stream_detail::cuda_stream_callable{std::forward(f)}); } template constexpr PIKA_FORCEINLINE auto PIKA_STATIC_CALL_OPERATOR(F&& f) { return pika::execution::experimental::detail::partial_algorithm{ - PIKA_FORWARD(F, f)}; + std::forward(f)}; } } then_with_stream{}; @@ -649,9 +649,9 @@ namespace pika::cuda::experimental { constexpr PIKA_FORCEINLINE auto PIKA_STATIC_CALL_OPERATOR(Sender&& sender, F&& f, cublasPointerMode_t pointer_mode) { - return then_with_stream_detail::then_with_cuda_stream(PIKA_FORWARD(Sender, sender), + return then_with_stream_detail::then_with_cuda_stream(std::forward(sender), then_with_stream_detail::cublas_handle_callable{ - PIKA_FORWARD(F, f), pointer_mode}); + std::forward(f), pointer_mode}); } template @@ -659,7 +659,7 @@ namespace pika::cuda::experimental { PIKA_STATIC_CALL_OPERATOR(F&& f, cublasPointerMode_t pointer_mode) { return pika::execution::experimental::detail::partial_algorithm{PIKA_FORWARD(F, f), pointer_mode}; + cublasPointerMode_t>{std::forward(f), pointer_mode}; } } then_with_cublas{}; @@ -676,15 +676,15 @@ namespace pika::cuda::experimental { template constexpr PIKA_FORCEINLINE auto PIKA_STATIC_CALL_OPERATOR(Sender&& sender, F&& f) { - return then_with_stream_detail::then_with_cuda_stream(PIKA_FORWARD(Sender, sender), - then_with_stream_detail::cusolver_handle_callable{PIKA_FORWARD(F, f)}); + return then_with_stream_detail::then_with_cuda_stream(std::forward(sender), + then_with_stream_detail::cusolver_handle_callable{std::forward(f)}); } template constexpr PIKA_FORCEINLINE auto PIKA_STATIC_CALL_OPERATOR(F&& f) { return pika::execution::experimental::detail::partial_algorithm{PIKA_FORWARD(F, f)}; + F>{std::forward(f)}; } } then_with_cusolver{}; } // namespace pika::cuda::experimental diff --git a/libs/pika/async_mpi/include/pika/async_mpi/dispatch_mpi.hpp b/libs/pika/async_mpi/include/pika/async_mpi/dispatch_mpi.hpp index d9289ea13..fb5214ff9 100644 --- a/libs/pika/async_mpi/include/pika/async_mpi/dispatch_mpi.hpp +++ b/libs/pika/async_mpi/include/pika/async_mpi/dispatch_mpi.hpp @@ -102,7 +102,7 @@ namespace pika::mpi::experimental::detail { friend constexpr void tag_invoke(ex::set_error_t, dispatch_mpi_receiver r, Error&& error) noexcept { - ex::set_error(std::move(r.op_state.receiver), PIKA_FORWARD(Error, error)); + ex::set_error(std::move(r.op_state.receiver), std::forward(error)); } friend constexpr void tag_invoke( @@ -195,9 +195,9 @@ namespace pika::mpi::experimental::detail { template operation_state(Receiver_&& receiver, F_&& f, Sender_&& sender) - : receiver(PIKA_FORWARD(Receiver_, receiver)) - , f(PIKA_FORWARD(F_, f)) - , op_state(ex::connect(PIKA_FORWARD(Sender_, sender), dispatch_mpi_receiver{*this})) + : receiver(std::forward(receiver)) + , f(std::forward(f)) + , op_state(ex::connect(std::forward(sender), dispatch_mpi_receiver{*this})) { PIKA_DETAIL_DP(mpi_tran<5>, debug(str<>("operation_state"))); } @@ -212,7 +212,7 @@ namespace pika::mpi::experimental::detail { friend constexpr auto tag_invoke(ex::connect_t, dispatch_mpi_sender_type const& s, Receiver&& receiver) { - return operation_state(PIKA_FORWARD(Receiver, receiver), s.f, s.sender); + return operation_state(std::forward(receiver), s.f, s.sender); } template @@ -220,7 +220,7 @@ namespace pika::mpi::experimental::detail { tag_invoke(ex::connect_t, dispatch_mpi_sender_type&& s, Receiver&& receiver) { return operation_state( - PIKA_FORWARD(Receiver, receiver), std::move(s.f), std::move(s.sender)); + std::forward(receiver), std::move(s.f), std::move(s.sender)); } }; @@ -238,7 +238,7 @@ namespace pika::mpi::experimental { tag_fallback_invoke(dispatch_mpi_t, Sender&& sender, F&& f) { auto snd1 = detail::dispatch_mpi_sender{ - PIKA_FORWARD(Sender, sender), PIKA_FORWARD(F, f)}; + std::forward(sender), std::forward(f)}; return pika::execution::experimental::make_unique_any_sender(std::move(snd1)); } @@ -246,7 +246,7 @@ namespace pika::mpi::experimental { friend constexpr PIKA_FORCEINLINE auto tag_fallback_invoke(dispatch_mpi_t, F&& f) { return pika::execution::experimental::detail::partial_algorithm{ - PIKA_FORWARD(F, f)}; + std::forward(f)}; } } dispatch_mpi{}; diff --git a/libs/pika/async_mpi/include/pika/async_mpi/mpi_helpers.hpp b/libs/pika/async_mpi/include/pika/async_mpi/mpi_helpers.hpp index f13abfd13..45c71d839 100644 --- a/libs/pika/async_mpi/include/pika/async_mpi/mpi_helpers.hpp +++ b/libs/pika/async_mpi/include/pika/async_mpi/mpi_helpers.hpp @@ -81,11 +81,11 @@ namespace pika::mpi::experimental::detail { static_assert(sizeof...(Ts) <= 1, "Expecting at most one value"); if (mpi_status == MPI_SUCCESS) { - ex::set_value(PIKA_FORWARD(Receiver, receiver), PIKA_FORWARD(Ts, ts)...); + ex::set_value(std::forward(receiver), std::forward(ts)...); } else { - ex::set_error(PIKA_FORWARD(Receiver, receiver), + ex::set_error(std::forward(receiver), std::make_exception_ptr(mpi::exception(mpi_status, "set_error handler"))); } } diff --git a/libs/pika/async_mpi/include/pika/async_mpi/transform_mpi.hpp b/libs/pika/async_mpi/include/pika/async_mpi/transform_mpi.hpp index ef9e48a10..8de5867f3 100644 --- a/libs/pika/async_mpi/include/pika/async_mpi/transform_mpi.hpp +++ b/libs/pika/async_mpi/include/pika/async_mpi/transform_mpi.hpp @@ -78,13 +78,13 @@ namespace pika::mpi::experimental { if (requests_inline) { - return dispatch_mpi_sender{std::move(sender), PIKA_FORWARD(F, f)} | + return dispatch_mpi_sender{std::move(sender), std::forward(f)} | let_value(completion_snd); } else { - auto snd0 = PIKA_FORWARD(Sender, sender) | continues_on(mpi_pool_scheduler(p)); - return dispatch_mpi_sender{std::move(snd0), PIKA_FORWARD(F, f)} | + auto snd0 = std::forward(sender) | continues_on(mpi_pool_scheduler(p)); + return dispatch_mpi_sender{std::move(snd0), std::forward(f)} | let_value(completion_snd); } } @@ -96,7 +96,7 @@ namespace pika::mpi::experimental { friend constexpr PIKA_FORCEINLINE auto tag_fallback_invoke(transform_mpi_t, F&& f) { return pika::execution::experimental::detail::partial_algorithm{ - PIKA_FORWARD(F, f)}; + std::forward(f)}; } } transform_mpi{}; diff --git a/libs/pika/async_mpi/include/pika/async_mpi/trigger_mpi.hpp b/libs/pika/async_mpi/include/pika/async_mpi/trigger_mpi.hpp index 6d25b9418..617eaa1e0 100644 --- a/libs/pika/async_mpi/include/pika/async_mpi/trigger_mpi.hpp +++ b/libs/pika/async_mpi/include/pika/async_mpi/trigger_mpi.hpp @@ -105,7 +105,7 @@ namespace pika::mpi::experimental::detail { friend constexpr void tag_invoke(ex::set_error_t, trigger_mpi_receiver r, Error&& error) noexcept { - ex::set_error(std::move(r.op_state.receiver), PIKA_FORWARD(Error, error)); + ex::set_error(std::move(r.op_state.receiver), std::forward(error)); } friend constexpr void tag_invoke(ex::set_stopped_t, trigger_mpi_receiver r) noexcept @@ -230,10 +230,10 @@ namespace pika::mpi::experimental::detail { template operation_state(Receiver_&& receiver, Sender_&& sender, int flags) - : receiver(PIKA_FORWARD(Receiver_, receiver)) + : receiver(std::forward(receiver)) , mode_flags{flags} , status{MPI_SUCCESS} - , op_state(ex::connect(PIKA_FORWARD(Sender_, sender), trigger_mpi_receiver{*this})) + , op_state(ex::connect(std::forward(sender), trigger_mpi_receiver{*this})) { } @@ -247,7 +247,7 @@ namespace pika::mpi::experimental::detail { friend constexpr auto tag_invoke(ex::connect_t, trigger_mpi_sender_type const& s, Receiver&& receiver) { - return operation_state(PIKA_FORWARD(Receiver, receiver), s.sender); + return operation_state(std::forward(receiver), s.sender); } template @@ -255,7 +255,7 @@ namespace pika::mpi::experimental::detail { tag_invoke(ex::connect_t, trigger_mpi_sender_type&& s, Receiver&& receiver) { return operation_state( - PIKA_FORWARD(Receiver, receiver), std::move(s.sender), s.completion_mode_flags_); + std::forward(receiver), std::move(s.sender), s.completion_mode_flags_); } }; @@ -273,7 +273,7 @@ namespace pika::mpi::experimental { friend constexpr PIKA_FORCEINLINE auto tag_fallback_invoke(trigger_mpi_t, Sender&& sender, int flags) { - return detail::trigger_mpi_sender{PIKA_FORWARD(Sender, sender), flags}; + return detail::trigger_mpi_sender{std::forward(sender), flags}; } // diff --git a/libs/pika/concurrency/include/pika/concurrency/concurrentqueue.hpp b/libs/pika/concurrency/include/pika/concurrency/concurrentqueue.hpp index 3e9a86e5c..1b613b7b9 100644 --- a/libs/pika/concurrency/include/pika/concurrency/concurrentqueue.hpp +++ b/libs/pika/concurrency/include/pika/concurrency/concurrentqueue.hpp @@ -52,8 +52,6 @@ #pragma once -#include - #if defined(__GNUC__) && !defined(__INTEL_COMPILER) // Disable -Wconversion warnings (spuriously triggered when Traits::size_t and // Traits::index_t are set to < 32 bits, causing integer promotion, causing warnings @@ -667,9 +665,9 @@ namespace pika::concurrency::detail { struct nomove_if { template - static inline auto eval(U&& x) -> decltype(PIKA_FORWARD(U, x)) + static inline auto eval(U&& x) -> decltype(std::forward(x)) { - return PIKA_FORWARD(U, x); + return std::forward(x); } }; @@ -1612,7 +1610,7 @@ namespace pika::concurrency::detail { { return static_cast(token.producer) ->ConcurrentQueue::ExplicitProducer::template enqueue( - PIKA_FORWARD(U, element)); + std::forward(element)); } template @@ -1622,7 +1620,7 @@ namespace pika::concurrency::detail { return producer == nullptr ? false : producer->ConcurrentQueue::ImplicitProducer::template enqueue( - PIKA_FORWARD(U, element)); + std::forward(element)); } template @@ -2265,13 +2263,13 @@ namespace pika::concurrency::detail { } MOODYCAMEL_CONSTEXPR_IF(!MOODYCAMEL_NOEXCEPT_CTOR( - T, U, new (static_cast(nullptr)) T(PIKA_FORWARD(U, element)))) + T, U, new (static_cast(nullptr)) T(std::forward(element)))) { // The constructor may throw. We want the element not to appear in the queue in // that case (without corrupting the queue): MOODYCAMEL_TRY { - new ((*this->tailBlock)[currentTailIndex]) T(PIKA_FORWARD(U, element)); + new ((*this->tailBlock)[currentTailIndex]) T(std::forward(element)); } MOODYCAMEL_CATCH(...) { @@ -2298,7 +2296,7 @@ namespace pika::concurrency::detail { pr_blockIndexFront = (pr_blockIndexFront + 1) & (pr_blockIndexSize - 1); MOODYCAMEL_CONSTEXPR_IF(!MOODYCAMEL_NOEXCEPT_CTOR( - T, U, new (static_cast(nullptr)) T(PIKA_FORWARD(U, element)))) + T, U, new (static_cast(nullptr)) T(std::forward(element)))) { this->tailIndex.store(newTailIndex, std::memory_order_release); return true; @@ -2306,7 +2304,7 @@ namespace pika::concurrency::detail { } // Enqueue - new ((*this->tailBlock)[currentTailIndex]) T(PIKA_FORWARD(U, element)); + new ((*this->tailBlock)[currentTailIndex]) T(std::forward(element)); this->tailIndex.store(newTailIndex, std::memory_order_release); return true; @@ -3017,12 +3015,12 @@ namespace pika::concurrency::detail { newBlock->ConcurrentQueue::Block::template reset_empty(); MOODYCAMEL_CONSTEXPR_IF(!MOODYCAMEL_NOEXCEPT_CTOR( - T, U, new (static_cast(nullptr)) T(PIKA_FORWARD(U, element)))) + T, U, new (static_cast(nullptr)) T(std::forward(element)))) { // May throw, try to insert now before we publish the fact that we have this new block MOODYCAMEL_TRY { - new ((*newBlock)[currentTailIndex]) T(PIKA_FORWARD(U, element)); + new ((*newBlock)[currentTailIndex]) T(std::forward(element)); } MOODYCAMEL_CATCH(...) { @@ -3039,7 +3037,7 @@ namespace pika::concurrency::detail { this->tailBlock = newBlock; MOODYCAMEL_CONSTEXPR_IF(!MOODYCAMEL_NOEXCEPT_CTOR( - T, U, new (static_cast(nullptr)) T(PIKA_FORWARD(U, element)))) + T, U, new (static_cast(nullptr)) T(std::forward(element)))) { this->tailIndex.store(newTailIndex, std::memory_order_release); return true; @@ -3047,7 +3045,7 @@ namespace pika::concurrency::detail { } // Enqueue - new ((*this->tailBlock)[currentTailIndex]) T(PIKA_FORWARD(U, element)); + new ((*this->tailBlock)[currentTailIndex]) T(std::forward(element)); this->tailIndex.store(newTailIndex, std::memory_order_release); return true; @@ -4341,7 +4339,7 @@ namespace pika::concurrency::detail { static inline U* create(A1&& a1) { void* p = aligned_malloc(sizeof(U)); - return p != nullptr ? new (p) U(PIKA_FORWARD(A1, a1)) : nullptr; + return p != nullptr ? new (p) U(std::forward(a1)) : nullptr; } template diff --git a/libs/pika/config/CMakeLists.txt b/libs/pika/config/CMakeLists.txt index 0019ed907..6122ea3e5 100644 --- a/libs/pika/config/CMakeLists.txt +++ b/libs/pika/config/CMakeLists.txt @@ -18,7 +18,6 @@ set(config_headers pika/config/emulate_deleted.hpp pika/config/export_definitions.hpp pika/config/forceinline.hpp - pika/config/forward.hpp pika/config/manual_profiling.hpp pika/config/static_call_operator.hpp pika/config/threads_stack.hpp diff --git a/libs/pika/config/include/pika/config.hpp b/libs/pika/config/include/pika/config.hpp index aa6a4f47d..97df2ff30 100644 --- a/libs/pika/config/include/pika/config.hpp +++ b/libs/pika/config/include/pika/config.hpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include diff --git a/libs/pika/config/include/pika/config/forward.hpp b/libs/pika/config/include/pika/config/forward.hpp deleted file mode 100644 index c99e25dcd..000000000 --- a/libs/pika/config/include/pika/config/forward.hpp +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) 2021 ETH Zurich -// -// SPDX-License-Identifier: BSL-1.0 -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -#pragma once - -#if defined(PIKA_HAVE_CXX_LAMBDA_CAPTURE_DECLTYPE) -# define PIKA_FORWARD(T, ...) static_cast(__VA_ARGS__) -#else -# define PIKA_FORWARD(T, ...) static_cast(__VA_ARGS__) -#endif diff --git a/libs/pika/coroutines/include/pika/coroutines/detail/coroutine_self.hpp b/libs/pika/coroutines/include/pika/coroutines/detail/coroutine_self.hpp index 11b4ca459..7f202dbf1 100644 --- a/libs/pika/coroutines/include/pika/coroutines/detail/coroutine_self.hpp +++ b/libs/pika/coroutines/include/pika/coroutines/detail/coroutine_self.hpp @@ -85,7 +85,7 @@ namespace pika::threads::coroutines::detail { template yield_decorator_type decorate_yield(F&& f) { - yield_decorator_type tmp(PIKA_FORWARD(F, f)); + yield_decorator_type tmp(std::forward(f)); std::swap(tmp, yield_decorator_); return tmp; } diff --git a/libs/pika/datastructures/include/pika/datastructures/detail/small_vector.hpp b/libs/pika/datastructures/include/pika/datastructures/detail/small_vector.hpp index 799c7845c..322edb0db 100644 --- a/libs/pika/datastructures/include/pika/datastructures/detail/small_vector.hpp +++ b/libs/pika/datastructures/include/pika/datastructures/detail/small_vector.hpp @@ -357,7 +357,7 @@ namespace pika::detail { template iterator emplace(const_iterator pos, Ts&&... ts) { - return data_.emplace(pos, PIKA_FORWARD(Ts, ts)...); + return data_.emplace(pos, std::forward(ts)...); } iterator erase(const_iterator pos) { return data_.erase(pos); } @@ -368,7 +368,7 @@ namespace pika::detail { template reference emplace_back(Ts&&... ts) { - return data_.emplace_back(PIKA_FORWARD(Ts, ts)...); + return data_.emplace_back(std::forward(ts)...); } void pop_back() { data_.pop_back(); } diff --git a/libs/pika/datastructures/include/pika/datastructures/member_pack.hpp b/libs/pika/datastructures/include/pika/datastructures/member_pack.hpp index 272edcff7..83aba1488 100644 --- a/libs/pika/datastructures/include/pika/datastructures/member_pack.hpp +++ b/libs/pika/datastructures/include/pika/datastructures/member_pack.hpp @@ -25,7 +25,7 @@ namespace pika::util::detail { template explicit constexpr member_leaf(std::piecewise_construct_t, U&& v) - : member(PIKA_FORWARD(U, v)) + : member(std::forward(v)) { } }; @@ -54,7 +54,7 @@ namespace pika::util::detail { template explicit constexpr member_leaf(std::piecewise_construct_t, U&& v) - : member(PIKA_FORWARD(U, v)) + : member(std::forward(v)) { } }; @@ -66,7 +66,7 @@ namespace pika::util::detail { template explicit constexpr member_leaf(std::piecewise_construct_t, U&& v) - : T(PIKA_FORWARD(U, v)) + : T(std::forward(v)) { } }; @@ -108,7 +108,7 @@ namespace pika::util::detail { template explicit constexpr member_pack(std::piecewise_construct_t, Us&&... us) - : member_leaf(std::piecewise_construct, PIKA_FORWARD(Us, us))... + : member_leaf(std::piecewise_construct, std::forward(us))... { } diff --git a/libs/pika/errors/include/pika/errors/exception_info.hpp b/libs/pika/errors/include/pika/errors/exception_info.hpp index cd79d714b..49b2adb16 100644 --- a/libs/pika/errors/include/pika/errors/exception_info.hpp +++ b/libs/pika/errors/include/pika/errors/exception_info.hpp @@ -55,7 +55,7 @@ namespace pika { } \ \ explicit NAME(TYPE&& value) \ - : error_info(PIKA_FORWARD(TYPE, value)) \ + : error_info(std::forward(value)) \ { \ } \ } /**/ @@ -125,7 +125,7 @@ namespace pika { { using node_type = detail::exception_info_node; - node_ptr node = std::make_shared(PIKA_FORWARD(ErrorInfo, tagged_values)...); + node_ptr node = std::make_shared(std::forward(tagged_values)...); node->next = std::move(_data); _data = std::move(node); return *this; @@ -184,13 +184,13 @@ namespace pika { static_assert( !std::is_base_of::value, "E shall not derive from exception_info"); - throw detail::exception_with_info(PIKA_FORWARD(E, e), std::move(xi)); + throw detail::exception_with_info(std::forward(e), std::move(xi)); } template [[noreturn]] void throw_with_info(E&& e, exception_info const& xi) { - throw_with_info(PIKA_FORWARD(E, e), exception_info(xi)); + throw_with_info(std::forward(e), exception_info(xi)); } /////////////////////////////////////////////////////////////////////////// @@ -208,15 +208,15 @@ namespace pika { /////////////////////////////////////////////////////////////////////////// template - auto invoke_with_exception_info(E const& e, F&& f) - -> decltype(PIKA_FORWARD(F, f)(std::declval())) + auto invoke_with_exception_info( + E const& e, F&& f) -> decltype(std::forward(f)(std::declval())) { - return PIKA_FORWARD(F, f)(dynamic_cast(std::addressof(e))); + return std::forward(f)(dynamic_cast(std::addressof(e))); } template - auto invoke_with_exception_info(std::exception_ptr const& p, F&& f) - -> decltype(PIKA_FORWARD(F, f)(std::declval())) + auto invoke_with_exception_info(std::exception_ptr const& p, + F&& f) -> decltype(std::forward(f)(std::declval())) { try { @@ -224,7 +224,7 @@ namespace pika { } catch (exception_info const& xi) { - return PIKA_FORWARD(F, f)(&xi); + return std::forward(f)(&xi); } catch (std::exception const& e) { @@ -233,13 +233,13 @@ namespace pika { catch (...) { } - return PIKA_FORWARD(F, f)(nullptr); + return std::forward(f)(nullptr); } template - auto invoke_with_exception_info(pika::error_code const& ec, F&& f) - -> decltype(PIKA_FORWARD(F, f)(std::declval())) + auto invoke_with_exception_info(pika::error_code const& ec, + F&& f) -> decltype(std::forward(f)(std::declval())) { - return invoke_with_exception_info(detail::access_exception(ec), PIKA_FORWARD(F, f)); + return invoke_with_exception_info(detail::access_exception(ec), std::forward(f)); } } // namespace pika diff --git a/libs/pika/execution/include/pika/execution/algorithms/bulk.hpp b/libs/pika/execution/include/pika/execution/algorithms/bulk.hpp index 1d12da913..7bdf2c5ac 100644 --- a/libs/pika/execution/include/pika/execution/algorithms/bulk.hpp +++ b/libs/pika/execution/include/pika/execution/algorithms/bulk.hpp @@ -74,9 +74,9 @@ namespace pika::bulk_detail { template bulk_receiver(Receiver_&& receiver, Shape_&& shape, F_&& f) - : receiver(PIKA_FORWARD(Receiver_, receiver)) - , shape(PIKA_FORWARD(Shape_, shape)) - , f(PIKA_FORWARD(F_, f)) + : receiver(std::forward(receiver)) + , shape(std::forward(shape)) + , f(std::forward(f)) { } @@ -85,7 +85,7 @@ namespace pika::bulk_detail { Error&& error) noexcept { pika::execution::experimental::set_error( - std::move(r.receiver), PIKA_FORWARD(Error, error)); + std::move(r.receiver), std::forward(error)); } friend void tag_invoke( @@ -101,7 +101,7 @@ namespace pika::bulk_detail { [&]() { for (auto const& s : shape) { PIKA_INVOKE(f, s, ts...); } pika::execution::experimental::set_value( - std::move(receiver), PIKA_FORWARD(Ts, ts)...); + std::move(receiver), std::forward(ts)...); }, [&](std::exception_ptr ep) { pika::execution::experimental::set_error( @@ -113,14 +113,14 @@ namespace pika::bulk_detail { friend auto tag_invoke( pika::execution::experimental::set_value_t, bulk_receiver&& r, Ts&&... ts) noexcept -> decltype(pika::execution::experimental::set_value( - std::declval&&>(), PIKA_FORWARD(Ts, ts)...), + std::declval&&>(), std::forward(ts)...), void()) { // set_value is in a member function only because of a // compiler bug in GCC 7. When the body of set_value is // inlined here compilation fails with an internal compiler // error. - r.set_value(PIKA_FORWARD(Ts, ts)...); + r.set_value(std::forward(ts)...); } }; @@ -130,7 +130,7 @@ namespace pika::bulk_detail { { return pika::execution::experimental::connect(std::move(s.sender), bulk_receiver( - PIKA_FORWARD(Receiver, receiver), std::move(s.shape), std::move(s.f))); + std::forward(receiver), std::move(s.shape), std::move(s.f))); } template @@ -138,7 +138,7 @@ namespace pika::bulk_detail { Receiver&& receiver) { return pika::execution::experimental::connect( - s.sender, bulk_receiver(PIKA_FORWARD(Receiver, receiver), s.shape, s.f)); + s.sender, bulk_receiver(std::forward(receiver), s.shape, s.f)); } }; } // namespace pika::bulk_detail @@ -163,7 +163,7 @@ namespace pika::execution::experimental { pika::execution::experimental::set_value_t>( pika::execution::experimental::get_env(sender)); return pika::functional::detail::tag_invoke(bulk_t{}, std::move(scheduler), - PIKA_FORWARD(Sender, sender), shape, PIKA_FORWARD(F, f)); + std::forward(sender), shape, std::forward(f)); } // clang-format off @@ -177,8 +177,8 @@ namespace pika::execution::experimental { tag_fallback_invoke(bulk_t, Sender&& sender, Shape const& shape, F&& f) { return bulk_detail::bulk_sender, - F>{PIKA_FORWARD(Sender, sender), pika::util::detail::make_counting_shape(shape), - PIKA_FORWARD(F, f)}; + F>{std::forward(sender), pika::util::detail::make_counting_shape(shape), + std::forward(f)}; } // clang-format off @@ -192,14 +192,14 @@ namespace pika::execution::experimental { tag_fallback_invoke(bulk_t, Sender&& sender, Shape&& shape, F&& f) { return bulk_detail::bulk_sender{ - PIKA_FORWARD(Sender, sender), PIKA_FORWARD(Shape, shape), PIKA_FORWARD(F, f)}; + std::forward(sender), std::forward(shape), std::forward(f)}; } template friend constexpr PIKA_FORCEINLINE auto tag_fallback_invoke(bulk_t, Shape&& shape, F&& f) { return detail::partial_algorithm{ - PIKA_FORWARD(Shape, shape), PIKA_FORWARD(F, f)}; + std::forward(shape), std::forward(f)}; } } bulk{}; } // namespace pika::execution::experimental diff --git a/libs/pika/execution/include/pika/execution/algorithms/continues_on.hpp b/libs/pika/execution/include/pika/execution/algorithms/continues_on.hpp index fbb3f9f42..27a64f2ab 100644 --- a/libs/pika/execution/include/pika/execution/algorithms/continues_on.hpp +++ b/libs/pika/execution/include/pika/execution/algorithms/continues_on.hpp @@ -43,8 +43,8 @@ namespace pika::execution::experimental { pika::execution::experimental::set_value_t>( pika::execution::experimental::get_env(sender)); return pika::functional::detail::tag_invoke(continues_on_t{}, - std::move(completion_scheduler), PIKA_FORWARD(Sender, sender), - PIKA_FORWARD(Scheduler, scheduler)); + std::move(completion_scheduler), std::forward(sender), + std::forward(scheduler)); } // clang-format off @@ -58,7 +58,7 @@ namespace pika::execution::experimental { tag_fallback_invoke(continues_on_t, Sender&& predecessor_sender, Scheduler&& scheduler) { return schedule_from( - PIKA_FORWARD(Scheduler, scheduler), PIKA_FORWARD(Sender, predecessor_sender)); + std::forward(scheduler), std::forward(predecessor_sender)); } template @@ -66,7 +66,7 @@ namespace pika::execution::experimental { tag_fallback_invoke(continues_on_t, Scheduler&& scheduler) { return detail::partial_algorithm{ - PIKA_FORWARD(Scheduler, scheduler)}; + std::forward(scheduler)}; } } continues_on{}; diff --git a/libs/pika/execution/include/pika/execution/algorithms/detail/partial_algorithm.hpp b/libs/pika/execution/include/pika/execution/algorithms/detail/partial_algorithm.hpp index 3374f70b0..fa7e6c883 100644 --- a/libs/pika/execution/include/pika/execution/algorithms/detail/partial_algorithm.hpp +++ b/libs/pika/execution/include/pika/execution/algorithms/detail/partial_algorithm.hpp @@ -25,7 +25,7 @@ namespace pika::execution::experimental::detail { public: template explicit constexpr partial_algorithm_base(Ts_&&... ts) - : ts(std::piecewise_construct, PIKA_FORWARD(Ts_, ts)...) + : ts(std::piecewise_construct, std::forward(ts)...) { } @@ -37,7 +37,7 @@ namespace pika::execution::experimental::detail { template friend constexpr PIKA_FORCEINLINE auto operator|(U&& u, partial_algorithm_base p) { - return Tag{}(PIKA_FORWARD(U, u), std::move(p.ts).template get()...); + return Tag{}(std::forward(u), std::move(p.ts).template get()...); } }; diff --git a/libs/pika/execution/include/pika/execution/algorithms/drop_operation_state.hpp b/libs/pika/execution/include/pika/execution/algorithms/drop_operation_state.hpp index 6facea50e..4276b3524 100644 --- a/libs/pika/execution/include/pika/execution/algorithms/drop_operation_state.hpp +++ b/libs/pika/execution/include/pika/execution/algorithms/drop_operation_state.hpp @@ -52,7 +52,7 @@ namespace pika::drop_op_state_detail { try { - auto error_local = PIKA_FORWARD(Error, error); + auto error_local = std::forward(error); r.op_state->op_state.reset(); pika::execution::experimental::set_error( @@ -87,7 +87,7 @@ namespace pika::drop_op_state_detail { try { - std::tuple...> ts_local(PIKA_FORWARD(Ts, ts)...); + std::tuple...> ts_local(std::forward(ts)...); r.op_state->op_state.reset(); std::apply(pika::util::detail::bind_front(pika::execution::experimental::set_value, @@ -130,7 +130,7 @@ namespace pika::drop_op_state_detail { template drop_op_state_op_state_type(std::decay_t sender, Receiver_&& receiver) - : receiver(PIKA_FORWARD(Receiver_, receiver)) + : receiver(std::forward(receiver)) , op_state(pika::detail::with_result_of([&]() mutable { return pika::execution::experimental::connect( std::move(sender), drop_op_state_receiver{this}); @@ -208,7 +208,7 @@ namespace pika::drop_op_state_detail { typename Enable = std::enable_if_t, drop_op_state_sender_type>>> explicit drop_op_state_sender_type(Sender_&& sender) - : sender(PIKA_FORWARD(Sender_, sender)) + : sender(std::forward(sender)) { } @@ -222,7 +222,7 @@ namespace pika::drop_op_state_detail { tag_invoke(pika::execution::experimental::connect_t, drop_op_state_sender_type&& s, Receiver&& receiver) { - return {std::move(s.sender), PIKA_FORWARD(Receiver, receiver)}; + return {std::move(s.sender), std::forward(receiver)}; } template @@ -230,7 +230,7 @@ namespace pika::drop_op_state_detail { tag_invoke(pika::execution::experimental::connect_t, drop_op_state_sender_type const& s, Receiver&& receiver) { - return {s.sender, PIKA_FORWARD(Receiver, receiver)}; + return {s.sender, std::forward(receiver)}; } }; } // namespace pika::drop_op_state_detail @@ -242,7 +242,7 @@ namespace pika::execution::experimental { template )> constexpr PIKA_FORCEINLINE auto PIKA_STATIC_CALL_OPERATOR(Sender&& sender) { - return drop_op_state_detail::drop_op_state_sender{PIKA_FORWARD(Sender, sender)}; + return drop_op_state_detail::drop_op_state_sender{std::forward(sender)}; } constexpr PIKA_FORCEINLINE auto PIKA_STATIC_CALL_OPERATOR() diff --git a/libs/pika/execution/include/pika/execution/algorithms/drop_value.hpp b/libs/pika/execution/include/pika/execution/algorithms/drop_value.hpp index 712d0510e..a06f10723 100644 --- a/libs/pika/execution/include/pika/execution/algorithms/drop_value.hpp +++ b/libs/pika/execution/include/pika/execution/algorithms/drop_value.hpp @@ -43,7 +43,7 @@ namespace pika::drop_value_detail { drop_value_receiver_type&& r, Error&& error) noexcept { pika::execution::experimental::set_error( - std::move(r.receiver), PIKA_FORWARD(Error, error)); + std::move(r.receiver), std::forward(error)); } friend void tag_invoke( @@ -109,7 +109,7 @@ namespace pika::drop_value_detail { Receiver&& receiver) { return pika::execution::experimental::connect(std::move(s.sender), - drop_value_receiver{PIKA_FORWARD(Receiver, receiver)}); + drop_value_receiver{std::forward(receiver)}); } template @@ -117,7 +117,7 @@ namespace pika::drop_value_detail { drop_value_sender_type const& r, Receiver&& receiver) { return pika::execution::experimental::connect( - r.sender, drop_value_receiver{PIKA_FORWARD(Receiver, receiver)}); + r.sender, drop_value_receiver{std::forward(receiver)}); } friend decltype(auto) tag_invoke( @@ -134,7 +134,7 @@ namespace pika::execution::experimental { template )> friend constexpr PIKA_FORCEINLINE auto tag_fallback_invoke(drop_value_t, Sender&& sender) { - return drop_value_detail::drop_value_sender{PIKA_FORWARD(Sender, sender)}; + return drop_value_detail::drop_value_sender{std::forward(sender)}; } using pika::functional::detail::tag_fallback::operator(); diff --git a/libs/pika/execution/include/pika/execution/algorithms/ensure_started.hpp b/libs/pika/execution/include/pika/execution/algorithms/ensure_started.hpp index ad0cdf31d..398e3a839 100644 --- a/libs/pika/execution/include/pika/execution/algorithms/ensure_started.hpp +++ b/libs/pika/execution/include/pika/execution/algorithms/ensure_started.hpp @@ -52,7 +52,7 @@ namespace pika::ensure_started_detail { void operator()(Error&& error) { pika::execution::experimental::set_error( - std::move(receiver), PIKA_FORWARD(Error, error)); + std::move(receiver), std::forward(error)); } }; @@ -68,7 +68,7 @@ namespace pika::ensure_started_detail { { std::apply(pika::util::detail::bind_front( pika::execution::experimental::set_value, std::move(receiver)), - PIKA_FORWARD(Ts, ts)); + std::forward(ts)); } }; @@ -199,7 +199,7 @@ namespace pika::ensure_started_detail { friend void tag_invoke(pika::execution::experimental::set_error_t, ensure_started_receiver r, Error&& error) noexcept { - r.state->v.template emplace(error_type(PIKA_FORWARD(Error, error))); + r.state->v.template emplace(error_type(std::forward(error))); r.state->set_predecessor_done(); } @@ -241,11 +241,11 @@ namespace pika::ensure_started_detail { -> decltype(std::declval< pika::detail::variant>() .template emplace( - std::make_tuple<>(PIKA_FORWARD(Ts, ts)...)), + std::make_tuple<>(std::forward(ts)...)), void()) { r.state->v.template emplace( - std::make_tuple<>(PIKA_FORWARD(Ts, ts)...)); + std::make_tuple<>(std::forward(ts)...)); r.state->set_predecessor_done(); } }; @@ -258,7 +258,7 @@ namespace pika::ensure_started_detail { { os.emplace(pika::detail::with_result_of([&]() { return pika::execution::experimental::connect( - PIKA_FORWARD(Sender_, sender), ensure_started_receiver{this}); + std::forward(sender), ensure_started_receiver{this}); })); } @@ -292,7 +292,7 @@ namespace pika::ensure_started_detail { std::is_same_v, value_type>>> void operator()(T&& t) { - pika::detail::visit(value_visitor{receiver}, PIKA_FORWARD(T, t)); + pika::detail::visit(value_visitor{receiver}, std::forward(t)); } }; @@ -434,7 +434,7 @@ namespace pika::ensure_started_detail { unique_ptr p(allocator_traits::allocate(alloc, 1), pika::detail::allocator_deleter{alloc}); - new (p.get()) shared_state{PIKA_FORWARD(Sender_, sender), allocator}; + new (p.get()) shared_state{std::forward(sender), allocator}; state = p.release(); state->start(); @@ -453,7 +453,7 @@ namespace pika::ensure_started_detail { template operation_state(Receiver_&& receiver, pika::intrusive_ptr state) - : receiver(PIKA_FORWARD(Receiver_, receiver)) + : receiver(std::forward(receiver)) , state(std::move(state)) { } @@ -474,7 +474,7 @@ namespace pika::ensure_started_detail { friend operation_state tag_invoke(pika::execution::experimental::connect_t, ensure_started_sender_type&& s, Receiver&& receiver) { - return {PIKA_FORWARD(Receiver, receiver), std::move(s.state)}; + return {std::forward(receiver), std::move(s.state)}; } template @@ -516,7 +516,7 @@ namespace pika::execution::experimental { tag_fallback_invoke(ensure_started_t, Sender&& sender) { return ensure_started_detail::ensure_started_sender>{PIKA_FORWARD(Sender, sender), {}}; + pika::detail::internal_allocator<>>{std::forward(sender), {}}; } template { - PIKA_FORWARD(Sender, sender), allocator}; + std::forward(sender), allocator}; } template (sender); } template { - PIKA_FORWARD(Sender, sender), allocator}; + std::forward(sender), allocator}; } template (sender); } template , diff --git a/libs/pika/execution/include/pika/execution/algorithms/execute.hpp b/libs/pika/execution/include/pika/execution/algorithms/execute.hpp index 65bf3c97f..e24d0c599 100644 --- a/libs/pika/execution/include/pika/execution/algorithms/execute.hpp +++ b/libs/pika/execution/include/pika/execution/algorithms/execute.hpp @@ -27,7 +27,7 @@ namespace pika::execution::experimental { tag_fallback_invoke(execute_t, Scheduler&& scheduler, F&& f) { return start_detached( - then(schedule(PIKA_FORWARD(Scheduler, scheduler)), PIKA_FORWARD(F, f))); + then(schedule(std::forward(scheduler)), std::forward(f))); } } execute{}; } // namespace pika::execution::experimental diff --git a/libs/pika/execution/include/pika/execution/algorithms/just.hpp b/libs/pika/execution/include/pika/execution/algorithms/just.hpp index e32645948..8ca2fdc6d 100644 --- a/libs/pika/execution/include/pika/execution/algorithms/just.hpp +++ b/libs/pika/execution/include/pika/execution/algorithms/just.hpp @@ -38,14 +38,14 @@ namespace pika::just_detail { template , just_sender_type>>> explicit constexpr just_sender_type(T&& t) - : ts(std::piecewise_construct, PIKA_FORWARD(T, t)) + : ts(std::piecewise_construct, std::forward(t)) { } template explicit constexpr just_sender_type(T0&& t0, T1&& t1, Ts_&&... ts) - : ts(std::piecewise_construct, PIKA_FORWARD(T0, t0), PIKA_FORWARD(T1, t1), - PIKA_FORWARD(Ts_, ts)...) + : ts(std::piecewise_construct, std::forward(t0), std::forward(t1), + std::forward(ts)...) { } @@ -71,7 +71,7 @@ namespace pika::just_detail { template operation_state(Receiver_&& receiver, pika::util::detail::member_pack_for...> ts) - : receiver(PIKA_FORWARD(Receiver_, receiver)) + : receiver(std::forward(receiver)) , ts(std::move(ts)) { } @@ -100,14 +100,14 @@ namespace pika::just_detail { friend auto tag_invoke( pika::execution::experimental::connect_t, just_sender_type&& s, Receiver&& receiver) { - return operation_state{PIKA_FORWARD(Receiver, receiver), std::move(s.ts)}; + return operation_state{std::forward(receiver), std::move(s.ts)}; } template friend auto tag_invoke(pika::execution::experimental::connect_t, just_sender_type const& s, Receiver&& receiver) { - return operation_state{PIKA_FORWARD(Receiver, receiver), s.ts}; + return operation_state{std::forward(receiver), s.ts}; } }; }; @@ -124,7 +124,7 @@ namespace pika::execution::experimental { { return just_detail::just_sender< typename pika::util::detail::make_index_pack::type, Ts...>{ - PIKA_FORWARD(Ts, ts)...}; + std::forward(ts)...}; } } just{}; } // namespace pika::execution::experimental diff --git a/libs/pika/execution/include/pika/execution/algorithms/let_error.hpp b/libs/pika/execution/include/pika/execution/algorithms/let_error.hpp index dcb32f5f5..59418c8a0 100644 --- a/libs/pika/execution/include/pika/execution/algorithms/let_error.hpp +++ b/libs/pika/execution/include/pika/execution/algorithms/let_error.hpp @@ -104,8 +104,8 @@ namespace pika::let_error_detail { template let_error_predecessor_receiver( Receiver_&& receiver, F_&& f, operation_state& op_state) - : receiver(PIKA_FORWARD(Receiver_, receiver)) - , f(PIKA_FORWARD(F_, f)) + : receiver(std::forward(receiver)) + , f(std::forward(f)) , op_state(op_state) { } @@ -176,7 +176,7 @@ namespace pika::let_error_detail { // TODO: receiver is moved before the visit, but // the invoke inside the visit may throw. r.op_state.predecessor_error.template emplace>( - PIKA_FORWARD(Error, error)); + std::forward(error)); pika::detail::visit(set_error_visitor{std::move(r.receiver), std::move(r.f), r.op_state}, r.op_state.predecessor_error); @@ -200,7 +200,7 @@ namespace pika::let_error_detail { let_error_predecessor_receiver&& r, Ts&&... ts) noexcept { pika::execution::experimental::set_value( - std::move(r.receiver), PIKA_FORWARD(Ts, ts)...); + std::move(r.receiver), std::forward(ts)...); } }; @@ -244,7 +244,7 @@ namespace pika::let_error_detail { : predecessor_operation_state{pika::execution::experimental::connect( std::forward(predecessor_sender), let_error_predecessor_receiver( - PIKA_FORWARD(Receiver_, receiver), PIKA_FORWARD(F_, f), *this))} + std::forward(receiver), std::forward(f), *this))} { } @@ -265,7 +265,7 @@ namespace pika::let_error_detail { Receiver&& receiver) { return operation_state( - std::move(s.predecessor_sender), PIKA_FORWARD(Receiver, receiver), std::move(s.f)); + std::move(s.predecessor_sender), std::forward(receiver), std::move(s.f)); } template @@ -294,13 +294,13 @@ namespace pika::execution::experimental { tag_fallback_invoke(let_error_t, PredecessorSender&& predecessor_sender, F&& f) { return let_error_detail::let_error_sender{ - PIKA_FORWARD(PredecessorSender, predecessor_sender), PIKA_FORWARD(F, f)}; + std::forward(predecessor_sender), std::forward(f)}; } template friend constexpr PIKA_FORCEINLINE auto tag_fallback_invoke(let_error_t, F&& f) { - return detail::partial_algorithm{PIKA_FORWARD(F, f)}; + return detail::partial_algorithm{std::forward(f)}; } } let_error{}; } // namespace pika::execution::experimental diff --git a/libs/pika/execution/include/pika/execution/algorithms/let_value.hpp b/libs/pika/execution/include/pika/execution/algorithms/let_value.hpp index cedba5b8d..fd4e8cafa 100644 --- a/libs/pika/execution/include/pika/execution/algorithms/let_value.hpp +++ b/libs/pika/execution/include/pika/execution/algorithms/let_value.hpp @@ -146,8 +146,8 @@ namespace pika::let_value_detail { template let_value_predecessor_receiver( Receiver_&& receiver, F_&& f, operation_state& op_state) - : receiver(PIKA_FORWARD(Receiver_, receiver)) - , f(PIKA_FORWARD(F_, f)) + : receiver(std::forward(receiver)) + , f(std::forward(f)) , op_state(op_state) { } @@ -157,7 +157,7 @@ namespace pika::let_value_detail { let_value_predecessor_receiver&& r, Error&& error) noexcept { pika::execution::experimental::set_error( - std::move(r.receiver), PIKA_FORWARD(Error, error)); + std::move(r.receiver), std::forward(error)); } friend void tag_invoke(pika::execution::experimental::set_stopped_t, @@ -237,7 +237,7 @@ namespace pika::let_value_detail { [&]() { op_state.predecessor_ts .template emplace...>>( - PIKA_FORWARD(Ts, ts)...); + std::forward(ts)...); pika::detail::visit( set_value_visitor{std::move(receiver), std::move(f), op_state}, op_state.predecessor_ts); @@ -253,23 +253,23 @@ namespace pika::let_value_detail { let_value_predecessor_receiver&& r, Ts&&... ts) noexcept -> decltype(std::declval() .template emplace...>>( - PIKA_FORWARD(Ts, ts)...), + std::forward(ts)...), void()) { // set_value is in a member function only because of a // compiler bug in GCC 7. When the body of set_value is // inlined here compilation fails with an internal // compiler error. - r.set_value(PIKA_FORWARD(Ts, ts)...); + r.set_value(std::forward(ts)...); } }; template operation_state(PredecessorSender_&& predecessor_sender, Receiver_&& receiver, F_&& f) : predecessor_op_state{pika::execution::experimental::connect( - PIKA_FORWARD(PredecessorSender_, predecessor_sender), + std::forward(predecessor_sender), let_value_predecessor_receiver( - PIKA_FORWARD(Receiver_, receiver), PIKA_FORWARD(F_, f), *this))} + std::forward(receiver), std::forward(f), *this))} { } @@ -290,7 +290,7 @@ namespace pika::let_value_detail { Receiver&& receiver) { return operation_state( - std::move(s.predecessor_sender), PIKA_FORWARD(Receiver, receiver), std::move(s.f)); + std::move(s.predecessor_sender), std::forward(receiver), std::move(s.f)); } template @@ -319,13 +319,13 @@ namespace pika::execution::experimental { tag_fallback_invoke(let_value_t, PredecessorSender&& predecessor_sender, F&& f) { return let_value_detail::let_value_sender{ - PIKA_FORWARD(PredecessorSender, predecessor_sender), PIKA_FORWARD(F, f)}; + std::forward(predecessor_sender), std::forward(f)}; } template friend constexpr PIKA_FORCEINLINE auto tag_fallback_invoke(let_value_t, F&& f) { - return detail::partial_algorithm{PIKA_FORWARD(F, f)}; + return detail::partial_algorithm{std::forward(f)}; } } let_value{}; } // namespace pika::execution::experimental diff --git a/libs/pika/execution/include/pika/execution/algorithms/require_started.hpp b/libs/pika/execution/include/pika/execution/algorithms/require_started.hpp index 59e13b3b9..6eeb750af 100644 --- a/libs/pika/execution/include/pika/execution/algorithms/require_started.hpp +++ b/libs/pika/execution/include/pika/execution/algorithms/require_started.hpp @@ -109,7 +109,7 @@ namespace pika { { PIKA_ASSERT(r.op_state != nullptr); pika::execution::experimental::set_error( - std::move(r.op_state->receiver), PIKA_FORWARD(Error, error)); + std::move(r.op_state->receiver), std::forward(error)); } friend void tag_invoke(pika::execution::experimental::set_stopped_t, @@ -125,7 +125,7 @@ namespace pika { { PIKA_ASSERT(r.op_state != nullptr); pika::execution::experimental::set_value( - std::move(r.op_state->receiver), PIKA_FORWARD(Ts, ts)...); + std::move(r.op_state->receiver), std::forward(ts)...); } friend constexpr pika::execution::experimental::empty_env tag_invoke( @@ -166,7 +166,7 @@ namespace pika { require_started_mode mode #endif ) - : receiver(PIKA_FORWARD(Receiver_, receiver)) + : receiver(std::forward(receiver)) , op_state(pika::detail::with_result_of([&]() { return pika::execution::experimental::connect(std::move(sender), require_started_receiver{this}); @@ -257,7 +257,7 @@ namespace pika { require_started_mode mode = require_started_mode::terminate_on_unstarted #endif ) - : sender(PIKA_FORWARD(Sender_, sender)) + : sender(std::forward(sender)) #if defined(PIKA_DETAIL_HAVE_REQUIRE_STARTED_MODE) , mode(mode) #endif @@ -380,13 +380,11 @@ namespace pika { } s.connected = true; - return - { - // NOLINTNEXTLINE(bugprone-unchecked-optional-access) - *std::exchange(s.sender, std::nullopt), PIKA_FORWARD(Receiver, receiver) + return {// NOLINTNEXTLINE(bugprone-unchecked-optional-access) + *std::exchange(s.sender, std::nullopt), std::forward(receiver) #if defined(PIKA_DETAIL_HAVE_REQUIRE_STARTED_MODE) , - s.mode + s.mode #endif }; } @@ -410,12 +408,10 @@ namespace pika { } s.connected = true; - return - { - *s.sender, PIKA_FORWARD(Receiver, receiver) + return {*s.sender, std::forward(receiver) #if defined(PIKA_DETAIL_HAVE_REQUIRE_STARTED_MODE) - , - s.mode + , + s.mode #endif }; } @@ -446,7 +442,7 @@ namespace pika { PIKA_STATIC_CALL_OPERATOR(Sender&& sender PIKA_DETAIL_REQUIRE_STARTED_MODE_PARAMETER) { return require_started_detail::require_started_sender{ - PIKA_FORWARD(Sender, sender) PIKA_DETAIL_REQUIRE_STARTED_MODE_ARGUMENT}; + std::forward(sender) PIKA_DETAIL_REQUIRE_STARTED_MODE_ARGUMENT}; } constexpr PIKA_FORCEINLINE auto PIKA_STATIC_CALL_OPERATOR() diff --git a/libs/pika/execution/include/pika/execution/algorithms/schedule_from.hpp b/libs/pika/execution/include/pika/execution/algorithms/schedule_from.hpp index a9715daf1..fd649e254 100644 --- a/libs/pika/execution/include/pika/execution/algorithms/schedule_from.hpp +++ b/libs/pika/execution/include/pika/execution/algorithms/schedule_from.hpp @@ -135,10 +135,10 @@ namespace pika::schedule_from_detail { template operation_state( Sender_&& predecessor_sender, Scheduler_&& scheduler, Receiver_&& receiver) - : scheduler(PIKA_FORWARD(Scheduler_, scheduler)) - , receiver(PIKA_FORWARD(Receiver_, receiver)) + : scheduler(std::forward(scheduler)) + , receiver(std::forward(receiver)) , sender_os(pika::execution::experimental::connect( - PIKA_FORWARD(Sender_, predecessor_sender), predecessor_sender_receiver{*this})) + std::forward(predecessor_sender), predecessor_sender_receiver{*this})) { } @@ -155,7 +155,7 @@ namespace pika::schedule_from_detail { friend void tag_invoke(pika::execution::experimental::set_error_t, predecessor_sender_receiver&& r, Error&& error) noexcept { - r.op_state.set_error_predecessor_sender(PIKA_FORWARD(Error, error)); + r.op_state.set_error_predecessor_sender(std::forward(error)); } friend void tag_invoke(pika::execution::experimental::set_stopped_t, @@ -185,7 +185,7 @@ namespace pika::schedule_from_detail { predecessor_sender_receiver&& r, Ts&&... ts) noexcept -> decltype(std::declval() .template emplace...>>( - PIKA_FORWARD(Ts, ts)...), + std::forward(ts)...), void()) { // nvcc fails to compile this with std::forward(ts)... @@ -194,7 +194,7 @@ namespace pika::schedule_from_detail { # if defined(PIKA_HAVE_CUDA) r.op_state.set_value_predecessor_sender(static_cast(ts)...); # else - r.op_state.set_value_predecessor_sender(PIKA_FORWARD(Ts, ts)...); + r.op_state.set_value_predecessor_sender(std::forward(ts)...); # endif } }; @@ -203,7 +203,7 @@ namespace pika::schedule_from_detail { void set_error_predecessor_sender(Error&& error) noexcept { pika::execution::experimental::set_error( - std::move(receiver), PIKA_FORWARD(Error, error)); + std::move(receiver), std::forward(error)); } void set_stopped_predecessor_sender() noexcept @@ -214,7 +214,7 @@ namespace pika::schedule_from_detail { template void set_value_predecessor_sender(Us&&... us) noexcept { - ts.template emplace...>>(PIKA_FORWARD(Us, us)...); + ts.template emplace...>>(std::forward(us)...); # if defined(PIKA_HAVE_CXX17_COPY_ELISION) // with_result_of is used to emplace the operation // state returned from connect without any @@ -243,7 +243,7 @@ namespace pika::schedule_from_detail { friend void tag_invoke(pika::execution::experimental::set_error_t, scheduler_sender_receiver&& r, Error&& error) noexcept { - r.op_state.set_error_scheduler_sender(PIKA_FORWARD(Error, error)); + r.op_state.set_error_scheduler_sender(std::forward(error)); } friend void tag_invoke(pika::execution::experimental::set_stopped_t, @@ -272,7 +272,7 @@ namespace pika::schedule_from_detail { { std::apply(pika::util::detail::bind_front( pika::execution::experimental::set_value, std::move(receiver)), - PIKA_FORWARD(Ts, ts)); + std::forward(ts)); } }; @@ -281,7 +281,7 @@ namespace pika::schedule_from_detail { { scheduler_op_state.reset(); pika::execution::experimental::set_error( - std::move(receiver), PIKA_FORWARD(Error, error)); + std::move(receiver), std::forward(error)); } void set_stopped_scheduler_sender() noexcept @@ -309,14 +309,14 @@ namespace pika::schedule_from_detail { schedule_from_sender_type&& s, Receiver&& receiver) { return {std::move(s.predecessor_sender), std::move(s.scheduler), - PIKA_FORWARD(Receiver, receiver)}; + std::forward(receiver)}; } template friend operation_state tag_invoke(pika::execution::experimental::connect_t, schedule_from_sender_type const& s, Receiver&& receiver) { - return {s.predecessor_sender, s.scheduler, PIKA_FORWARD(Receiver, receiver)}; + return {s.predecessor_sender, s.scheduler, std::forward(receiver)}; } }; } // namespace pika::schedule_from_detail @@ -336,7 +336,7 @@ namespace pika::execution::experimental { tag_fallback_invoke(schedule_from_t, Scheduler&& scheduler, Sender&& predecessor_sender) { return schedule_from_detail::schedule_from_sender{ - PIKA_FORWARD(Sender, predecessor_sender), PIKA_FORWARD(Scheduler, scheduler)}; + std::forward(predecessor_sender), std::forward(scheduler)}; } } schedule_from{}; } // namespace pika::execution::experimental diff --git a/libs/pika/execution/include/pika/execution/algorithms/split.hpp b/libs/pika/execution/include/pika/execution/algorithms/split.hpp index ddcb83bdf..05f25d9a6 100644 --- a/libs/pika/execution/include/pika/execution/algorithms/split.hpp +++ b/libs/pika/execution/include/pika/execution/algorithms/split.hpp @@ -166,7 +166,7 @@ namespace pika::split_detail { friend void tag_invoke(pika::execution::experimental::set_error_t, split_receiver r, Error&& error) noexcept { - r.state->v.template emplace(error_type(PIKA_FORWARD(Error, error))); + r.state->v.template emplace(error_type(std::forward(error))); r.state->set_predecessor_done(); } @@ -195,11 +195,11 @@ namespace pika::split_detail { -> decltype(std::declval< pika::detail::variant>() .template emplace( - std::make_tuple<>(PIKA_FORWARD(Ts, ts)...)), + std::make_tuple<>(std::forward(ts)...)), void()) { r.state->v.template emplace( - std::make_tuple<>(PIKA_FORWARD(Ts, ts)...)); + std::make_tuple<>(std::forward(ts)...)); r.state->set_predecessor_done(); } @@ -213,7 +213,7 @@ namespace pika::split_detail { { os.emplace(pika::detail::with_result_of([&]() { return pika::execution::experimental::connect( - PIKA_FORWARD(Sender_, sender), split_receiver{this}); + std::forward(sender), split_receiver{this}); })); } @@ -383,7 +383,7 @@ namespace pika::split_detail { unique_ptr p(allocator_traits::allocate(alloc, 1), pika::detail::allocator_deleter{alloc}); - new (p.get()) shared_state{PIKA_FORWARD(Sender_, sender), allocator}; + new (p.get()) shared_state{std::forward(sender), allocator}; state = p.release(); } @@ -400,7 +400,7 @@ namespace pika::split_detail { template operation_state(Receiver_&& receiver, pika::intrusive_ptr state) - : receiver(PIKA_FORWARD(Receiver_, receiver)) + : receiver(std::forward(receiver)) , state(std::move(state)) { } @@ -422,14 +422,14 @@ namespace pika::split_detail { friend operation_state tag_invoke( pika::execution::experimental::connect_t, split_sender_type&& s, Receiver&& receiver) { - return {PIKA_FORWARD(Receiver, receiver), std::move(s.state)}; + return {std::forward(receiver), std::move(s.state)}; } template friend operation_state tag_invoke(pika::execution::experimental::connect_t, split_sender_type const& s, Receiver&& receiver) { - return {PIKA_FORWARD(Receiver, receiver), s.state}; + return {std::forward(receiver), s.state}; } }; @@ -457,7 +457,7 @@ namespace pika::execution::experimental { friend constexpr PIKA_FORCEINLINE auto tag_fallback_invoke(split_t, Sender&& sender) { return split_detail::split_sender>{ - PIKA_FORWARD(Sender, sender), {}}; + std::forward(sender), {}}; } template { - PIKA_FORWARD(Sender, sender), allocator}; + std::forward(sender), allocator}; } template (sender); } template { - PIKA_FORWARD(Sender, sender), allocator}; + std::forward(sender), allocator}; } template )> friend constexpr PIKA_FORCEINLINE auto tag_fallback_invoke(split_t, Sender&& sender) { - return PIKA_FORWARD(Sender, sender); + return std::forward(sender); } template , diff --git a/libs/pika/execution/include/pika/execution/algorithms/split_tuple.hpp b/libs/pika/execution/include/pika/execution/algorithms/split_tuple.hpp index 9948f954d..085308e48 100644 --- a/libs/pika/execution/include/pika/execution/algorithms/split_tuple.hpp +++ b/libs/pika/execution/include/pika/execution/algorithms/split_tuple.hpp @@ -119,7 +119,7 @@ namespace pika::split_tuple_detail { friend void tag_invoke(pika::execution::experimental::set_error_t, split_tuple_receiver&& r, Error&& error) noexcept { - r.state.v.template emplace(error_type(PIKA_FORWARD(Error, error))); + r.state.v.template emplace(error_type(std::forward(error))); r.state.set_predecessor_done(); } @@ -151,10 +151,10 @@ namespace pika::split_tuple_detail { split_tuple_receiver&& r, T&& t) noexcept -> decltype(std::declval< pika::detail::variant>() - .template emplace(PIKA_FORWARD(T, t)), + .template emplace(std::forward(t)), void()) { - r.state.v.template emplace(PIKA_FORWARD(T, t)); + r.state.v.template emplace(std::forward(t)); r.state.set_predecessor_done(); } @@ -173,7 +173,7 @@ namespace pika::split_tuple_detail { { os.emplace(pika::detail::with_result_of([&]() { return pika::execution::experimental::connect( - PIKA_FORWARD(Sender_, sender), split_tuple_receiver{*this}); + std::forward(sender), split_tuple_receiver{*this}); })); } @@ -439,7 +439,7 @@ namespace pika::split_tuple_detail { template operation_state(Receiver_&& receiver, pika::intrusive_ptr state) - : receiver(PIKA_FORWARD(Receiver_, receiver)) + : receiver(std::forward(receiver)) , state(std::move(state)) { } @@ -461,7 +461,7 @@ namespace pika::split_tuple_detail { friend operation_state tag_invoke(pika::execution::experimental::connect_t, split_tuple_sender_type&& s, Receiver&& receiver) { - return {PIKA_FORWARD(Receiver, receiver), std::move(s.state)}; + return {std::forward(receiver), std::move(s.state)}; } template @@ -498,7 +498,7 @@ namespace pika::split_tuple_detail { unique_ptr p(allocator_traits::allocate(alloc, 1), pika::detail::allocator_deleter{alloc}); - new (p.get()) shared_state_type{PIKA_FORWARD(Sender, sender), allocator}; + new (p.get()) shared_state_type{std::forward(sender), allocator}; pika::intrusive_ptr state = p.release(); // nvcc does not like decay_t, so this uses decay<>::type instead. @@ -530,7 +530,7 @@ namespace pika::execution::experimental { friend constexpr PIKA_FORCEINLINE auto tag_fallback_invoke(split_tuple_t, Sender&& sender) { return split_tuple_detail::make_split_tuple_senders( - PIKA_FORWARD(Sender, sender), pika::detail::internal_allocator<>{}); + std::forward(sender), pika::detail::internal_allocator<>{}); } template (sender), allocator); } template , diff --git a/libs/pika/execution/include/pika/execution/algorithms/start_detached.hpp b/libs/pika/execution/include/pika/execution/algorithms/start_detached.hpp index ff054e687..5bff938b7 100644 --- a/libs/pika/execution/include/pika/execution/algorithms/start_detached.hpp +++ b/libs/pika/execution/include/pika/execution/algorithms/start_detached.hpp @@ -90,7 +90,7 @@ namespace pika::start_detached_detail { explicit operation_state_holder(Sender_&& sender, allocator_type const& alloc) : alloc(alloc) , op_state(pika::execution::experimental::connect( - PIKA_FORWARD(Sender_, sender), start_detached_receiver{*this})) + std::forward(sender), start_detached_receiver{*this})) { pika::execution::experimental::start(op_state); } @@ -133,7 +133,7 @@ namespace pika::execution::experimental { unique_ptr p(allocator_traits::allocate(alloc, 1), pika::detail::allocator_deleter{alloc}); - new (p.get()) operation_state_type{PIKA_FORWARD(Sender, sender), alloc}; + new (p.get()) operation_state_type{std::forward(sender), alloc}; PIKA_UNUSED(p.release()); } } start_detached{}; diff --git a/libs/pika/execution/include/pika/execution/algorithms/sync_wait.hpp b/libs/pika/execution/include/pika/execution/algorithms/sync_wait.hpp index 013215984..ef732f448 100644 --- a/libs/pika/execution/include/pika/execution/algorithms/sync_wait.hpp +++ b/libs/pika/execution/include/pika/execution/algorithms/sync_wait.hpp @@ -164,7 +164,7 @@ namespace pika::sync_wait_detail { friend void tag_invoke(pika::execution::experimental::set_error_t, sync_wait_receiver_type&& r, Error&& error) noexcept { - r.state.value.template emplace(PIKA_FORWARD(Error, error)); + r.state.value.template emplace(std::forward(error)); r.signal_set_called(); } @@ -180,7 +180,7 @@ namespace pika::sync_wait_detail { friend void tag_invoke(pika::execution::experimental::set_value_t, sync_wait_receiver_type&& r, Us&&... us) noexcept { - r.state.value.template emplace(PIKA_FORWARD(Us, us)...); + r.state.value.template emplace(std::forward(us)...); r.signal_set_called(); } @@ -209,7 +209,7 @@ namespace pika::this_thread::experimental { state_type state{}; auto op_state = pika::execution::experimental::connect( - PIKA_FORWARD(Sender, sender), receiver_type{state}); + std::forward(sender), receiver_type{state}); pika::execution::experimental::start(op_state); state.wait(); diff --git a/libs/pika/execution/include/pika/execution/algorithms/then.hpp b/libs/pika/execution/include/pika/execution/algorithms/then.hpp index ea8474768..3d9c94651 100644 --- a/libs/pika/execution/include/pika/execution/algorithms/then.hpp +++ b/libs/pika/execution/include/pika/execution/algorithms/then.hpp @@ -46,7 +46,7 @@ namespace pika::then_detail { Error&& error) noexcept { pika::execution::experimental::set_error( - std::move(r.receiver), PIKA_FORWARD(Error, error)); + std::move(r.receiver), std::forward(error)); } friend void tag_invoke( @@ -66,9 +66,9 @@ namespace pika::then_detail { // Certain versions of GCC with optimizations fail on // the move with an internal compiler error. # if defined(PIKA_GCC_VERSION) && (PIKA_GCC_VERSION < 100000) - PIKA_INVOKE(std::move(f), PIKA_FORWARD(Ts, ts)...); + PIKA_INVOKE(std::move(f), std::forward(ts)...); # else - PIKA_INVOKE(std::move(f), PIKA_FORWARD(Ts, ts)...); + PIKA_INVOKE(std::move(f), std::forward(ts)...); # endif pika::execution::experimental::set_value(std::move(receiver)); } @@ -78,10 +78,10 @@ namespace pika::then_detail { // the move with an internal compiler error. # if defined(PIKA_GCC_VERSION) && (PIKA_GCC_VERSION < 100000) pika::execution::experimental::set_value(std::move(receiver), - PIKA_INVOKE(std::move(f), PIKA_FORWARD(Ts, ts)...)); + PIKA_INVOKE(std::move(f), std::forward(ts)...)); # else pika::execution::experimental::set_value(std::move(receiver), - PIKA_INVOKE(std::move(f), PIKA_FORWARD(Ts, ts)...)); + PIKA_INVOKE(std::move(f), std::forward(ts)...)); # endif } }, @@ -96,7 +96,7 @@ namespace pika::then_detail { { // GCC 7 fails with an internal compiler error unless the actual // body is in a helper function. - r.set_value_helper(PIKA_FORWARD(Ts, ts)...); + r.set_value_helper(std::forward(ts)...); } }; @@ -145,7 +145,7 @@ namespace pika::then_detail { pika::execution::experimental::connect_t, then_sender_type&& s, Receiver&& receiver) { return pika::execution::experimental::connect(std::move(s.sender), - then_receiver{PIKA_FORWARD(Receiver, receiver), std::move(s.f)}); + then_receiver{std::forward(receiver), std::move(s.f)}); } template @@ -153,7 +153,7 @@ namespace pika::then_detail { Receiver&& receiver) { return pika::execution::experimental::connect( - r.sender, then_receiver{PIKA_FORWARD(Receiver, receiver), r.f}); + r.sender, then_receiver{std::forward(receiver), r.f}); } friend decltype(auto) tag_invoke( @@ -177,13 +177,13 @@ namespace pika::execution::experimental { friend constexpr PIKA_FORCEINLINE auto tag_fallback_invoke(then_t, Sender&& sender, F&& f) { return then_detail::then_sender{ - PIKA_FORWARD(Sender, sender), PIKA_FORWARD(F, f)}; + std::forward(sender), std::forward(f)}; } template friend constexpr PIKA_FORCEINLINE auto tag_fallback_invoke(then_t, F&& f) { - return detail::partial_algorithm{PIKA_FORWARD(F, f)}; + return detail::partial_algorithm{std::forward(f)}; } } then{}; } // namespace pika::execution::experimental diff --git a/libs/pika/execution/include/pika/execution/algorithms/transfer_just.hpp b/libs/pika/execution/include/pika/execution/algorithms/transfer_just.hpp index a06d1bd89..fe799c8f0 100644 --- a/libs/pika/execution/include/pika/execution/algorithms/transfer_just.hpp +++ b/libs/pika/execution/include/pika/execution/algorithms/transfer_just.hpp @@ -28,7 +28,7 @@ namespace pika::execution::experimental { friend constexpr PIKA_FORCEINLINE auto tag_fallback_invoke(transfer_just_t, Scheduler&& scheduler, Ts&&... ts) { - return continues_on(just(PIKA_FORWARD(Ts, ts)...), PIKA_FORWARD(Scheduler, scheduler)); + return continues_on(just(std::forward(ts)...), std::forward(scheduler)); } } transfer_just{}; } // namespace pika::execution::experimental diff --git a/libs/pika/execution/include/pika/execution/algorithms/transfer_when_all.hpp b/libs/pika/execution/include/pika/execution/algorithms/transfer_when_all.hpp index e2566546d..68186426c 100644 --- a/libs/pika/execution/include/pika/execution/algorithms/transfer_when_all.hpp +++ b/libs/pika/execution/include/pika/execution/algorithms/transfer_when_all.hpp @@ -29,7 +29,7 @@ namespace pika::execution::experimental { tag_fallback_invoke(transfer_when_all_t, Scheduler&& scheduler, Ts&&... ts) { return continues_on( - when_all(PIKA_FORWARD(Ts, ts)...), PIKA_FORWARD(Scheduler, scheduler)); + when_all(std::forward(ts)...), std::forward(scheduler)); } } transfer_when_all{}; } // namespace pika::execution::experimental diff --git a/libs/pika/execution/include/pika/execution/algorithms/unpack.hpp b/libs/pika/execution/include/pika/execution/algorithms/unpack.hpp index bd71cb320..9a4fe643b 100644 --- a/libs/pika/execution/include/pika/execution/algorithms/unpack.hpp +++ b/libs/pika/execution/include/pika/execution/algorithms/unpack.hpp @@ -46,7 +46,7 @@ namespace pika::unpack_detail { Error&& error) noexcept { pika::execution::experimental::set_error( - std::move(r.receiver), PIKA_FORWARD(Error, error)); + std::move(r.receiver), std::forward(error)); } friend void tag_invoke( @@ -61,7 +61,7 @@ namespace pika::unpack_detail { { std::apply(pika::util::detail::bind_front( pika::execution::experimental::set_value, std::move(r.receiver)), - PIKA_FORWARD(Ts, ts)); + std::forward(ts)); } friend constexpr pika::execution::experimental::empty_env tag_invoke( @@ -178,7 +178,7 @@ namespace pika::unpack_detail { pika::execution::experimental::connect_t, unpack_sender_type&& s, Receiver&& receiver) { return pika::execution::experimental::connect( - std::move(s.sender), unpack_receiver{PIKA_FORWARD(Receiver, receiver)}); + std::move(s.sender), unpack_receiver{std::forward(receiver)}); } template @@ -186,7 +186,7 @@ namespace pika::unpack_detail { unpack_sender_type const& r, Receiver&& receiver) { return pika::execution::experimental::connect( - r.sender, unpack_receiver{PIKA_FORWARD(Receiver, receiver)}); + r.sender, unpack_receiver{std::forward(receiver)}); } friend decltype(auto) tag_invoke( @@ -204,7 +204,7 @@ namespace pika::execution::experimental { template )> friend constexpr PIKA_FORCEINLINE auto tag_fallback_invoke(unpack_t, Sender&& sender) { - return unpack_detail::unpack_sender{PIKA_FORWARD(Sender, sender)}; + return unpack_detail::unpack_sender{std::forward(sender)}; } friend constexpr PIKA_FORCEINLINE auto tag_invoke(unpack_t) diff --git a/libs/pika/execution/include/pika/execution/algorithms/when_all.hpp b/libs/pika/execution/include/pika/execution/algorithms/when_all.hpp index 14b55854b..dccfb7e90 100644 --- a/libs/pika/execution/include/pika/execution/algorithms/when_all.hpp +++ b/libs/pika/execution/include/pika/execution/algorithms/when_all.hpp @@ -63,7 +63,7 @@ namespace pika::when_all_impl { { try { - r.op_state.error = PIKA_FORWARD(Error, error); + r.op_state.error = std::forward(error); } catch (...) { @@ -86,7 +86,7 @@ namespace pika::when_all_impl { auto set_value_helper(pika::util::detail::index_pack, Ts&&... ts) -> decltype((std::declval() .template get() - .emplace(PIKA_FORWARD(Ts, ts)), + .emplace(std::forward(ts)), ...), void()) { @@ -94,7 +94,7 @@ namespace pika::when_all_impl { // emplace the values using the offset calculated while // constructing the operation state. (op_state.ts.template get().emplace( - PIKA_FORWARD(Ts, ts)), + std::forward(ts)), ...); } @@ -103,7 +103,7 @@ namespace pika::when_all_impl { template auto set_value(Ts&&... ts) noexcept - -> decltype(set_value_helper(index_pack_type{}, PIKA_FORWARD(Ts, ts)...), void()) + -> decltype(set_value_helper(index_pack_type{}, std::forward(ts)...), void()) { if constexpr (OperationState::sender_pack_size > 0) { @@ -111,7 +111,7 @@ namespace pika::when_all_impl { { try { - set_value_helper(index_pack_type{}, PIKA_FORWARD(Ts, ts)...); + set_value_helper(index_pack_type{}, std::forward(ts)...); } catch (...) { @@ -138,10 +138,10 @@ namespace pika::when_all_impl { // unique namespace nothing but when_all_receiver should ever find this // overload. template - auto tag_invoke(pika::execution::experimental::set_value_t, Receiver&& r, Ts&&... ts) noexcept - -> decltype(r.set_value(PIKA_FORWARD(Ts, ts)...), void()) + auto tag_invoke(pika::execution::experimental::set_value_t, Receiver&& r, + Ts&&... ts) noexcept -> decltype(r.set_value(std::forward(ts)...), void()) { - r.set_value(PIKA_FORWARD(Ts, ts)...); + r.set_value(std::forward(ts)...); } template @@ -161,7 +161,7 @@ namespace pika::when_all_impl { template explicit constexpr when_all_sender_type(Senders_&&... senders) - : senders(std::piecewise_construct, PIKA_FORWARD(Senders_, senders)...) + : senders(std::piecewise_construct, std::forward(senders)...) { } @@ -257,12 +257,12 @@ namespace pika::when_all_impl { template operation_state(Receiver_&& receiver, Senders_&& senders) - : receiver(PIKA_FORWARD(Receiver_, receiver)) + : receiver(std::forward(receiver)) , op_state(pika::execution::experimental::connect( # if defined(PIKA_CUDA_VERSION) std::forward(senders).template get(), # else - PIKA_FORWARD(Senders_, senders).template get(), + std::forward(senders).template get(), # endif when_all_receiver(*this))) { @@ -293,7 +293,7 @@ namespace pika::when_all_impl { pika::detail::visit( [this](auto&& error) { pika::execution::experimental::set_error( - std::move(receiver), PIKA_FORWARD(decltype(error), error)); + std::move(receiver), std::forward(error)); }, std::move(*error)); } @@ -325,12 +325,12 @@ namespace pika::when_all_impl { template operation_state(Receiver_&& receiver, SendersPack_&& senders) - : base_type(PIKA_FORWARD(Receiver_, receiver), PIKA_FORWARD(SendersPack_, senders)) + : base_type(std::forward(receiver), std::forward(senders)) , op_state(pika::execution::experimental::connect( # if defined(PIKA_CUDA_VERSION) std::forward(senders).template get(), # else - PIKA_FORWARD(SendersPack_, senders).template get(), + std::forward(senders).template get(), # endif when_all_receiver(*this))) { @@ -360,7 +360,7 @@ namespace pika::when_all_impl { pika::execution::experimental::connect_t, when_all_sender_type&& s, Receiver&& receiver) { return operation_state( - PIKA_FORWARD(Receiver, receiver), std::move(s.senders)); + std::forward(receiver), std::move(s.senders)); } template @@ -368,7 +368,7 @@ namespace pika::when_all_impl { when_all_sender_type const& s, Receiver&& receiver) { return operation_state( - PIKA_FORWARD(Receiver, receiver), s.senders); + std::forward(receiver), s.senders); } }; } // namespace pika::when_all_impl @@ -386,7 +386,7 @@ namespace pika::execution::experimental { friend constexpr PIKA_FORCEINLINE auto tag_fallback_invoke(when_all_t, Senders&&... senders) { return pika::when_all_impl::when_all_sender{ - PIKA_FORWARD(Senders, senders)...}; + std::forward(senders)...}; } } when_all{}; } // namespace pika::execution::experimental diff --git a/libs/pika/execution/include/pika/execution/algorithms/when_all_vector.hpp b/libs/pika/execution/include/pika/execution/algorithms/when_all_vector.hpp index fbacc14b5..785e665f6 100644 --- a/libs/pika/execution/include/pika/execution/algorithms/when_all_vector.hpp +++ b/libs/pika/execution/include/pika/execution/algorithms/when_all_vector.hpp @@ -156,7 +156,7 @@ namespace pika::when_all_vector_detail { { try { - r.op_state.error = PIKA_FORWARD(Error, error); + r.op_state.error = std::forward(error); } catch (...) { @@ -189,7 +189,7 @@ namespace pika::when_all_vector_detail { // predecessor senders that send nothing. if constexpr (sizeof...(Ts) == 1) { - r.op_state.ts[r.i].emplace(PIKA_FORWARD(Ts, ts)...); + r.op_state.ts[r.i].emplace(std::forward(ts)...); } } catch (...) @@ -247,7 +247,7 @@ namespace pika::when_all_vector_detail { template operation_state(Receiver_&& receiver, std::vector senders) : num_predecessors(senders.size()) - , receiver(PIKA_FORWARD(Receiver_, receiver)) + , receiver(std::forward(receiver)) { op_states = std::make_unique[]>(num_predecessors); @@ -297,7 +297,7 @@ namespace pika::when_all_vector_detail { pika::detail::visit( [this](auto&& error) { pika::execution::experimental::set_error( - std::move(receiver), PIKA_FORWARD(decltype(error), error)); + std::move(receiver), std::forward(error)); }, std::move(*error)); } @@ -362,14 +362,14 @@ namespace pika::when_all_vector_detail { when_all_vector_sender_type&& s, Receiver&& receiver) { return operation_state( - PIKA_FORWARD(Receiver, receiver), std::move(s.senders)); + std::forward(receiver), std::move(s.senders)); } template friend auto tag_invoke(pika::execution::experimental::connect_t, when_all_vector_sender_type const& s, Receiver&& receiver) { - return operation_state(PIKA_FORWARD(Receiver, receiver), s.senders); + return operation_state(std::forward(receiver), s.senders); } }; } // namespace pika::when_all_vector_detail diff --git a/libs/pika/execution_base/include/pika/execution_base/any_sender.hpp b/libs/pika/execution_base/include/pika/execution_base/any_sender.hpp index 64e696913..86d61a7ed 100644 --- a/libs/pika/execution_base/include/pika/execution_base/any_sender.hpp +++ b/libs/pika/execution_base/include/pika/execution_base/any_sender.hpp @@ -275,13 +275,13 @@ namespace pika::detail { if constexpr (can_use_embedded_storage()) { Impl* p = reinterpret_cast(&embedded_storage); - new (p) Impl(PIKA_FORWARD(Ts, ts)...); + new (p) Impl(std::forward(ts)...); object = p; } else #endif { - heap_storage = new Impl(PIKA_FORWARD(Ts, ts)...); + heap_storage = new Impl(std::forward(ts)...); object = heap_storage; } } @@ -395,7 +395,7 @@ namespace pika::execution::experimental::detail { template any_operation_state_impl(Sender_&& sender, Receiver_&& receiver) : operation_state(pika::execution::experimental::connect( - PIKA_FORWARD(Sender_, sender), PIKA_FORWARD(Receiver_, receiver))) + std::forward(sender), std::forward(receiver))) { } ~any_operation_state_impl() noexcept = default; @@ -417,7 +417,7 @@ namespace pika::execution::experimental::detail { any_operation_state(Sender&& sender, Receiver&& receiver) { storage.template store>( - PIKA_FORWARD(Sender, sender), PIKA_FORWARD(Receiver, receiver)); + std::forward(sender), std::forward(receiver)); } ~any_operation_state() noexcept = default; @@ -483,7 +483,7 @@ namespace pika::execution::experimental::detail { typename = std::enable_if_t, any_receiver_impl>>> explicit any_receiver_impl(Receiver_&& receiver) - : receiver(PIKA_FORWARD(Receiver_, receiver)) + : receiver(std::forward(receiver)) { } @@ -521,14 +521,14 @@ namespace pika::execution::experimental::detail { typename = std::enable_if_t, any_receiver>>> explicit any_receiver(Receiver&& receiver) { - storage.template store>(PIKA_FORWARD(Receiver, receiver)); + storage.template store>(std::forward(receiver)); } template , any_receiver>>> any_receiver& operator=(Receiver&& receiver) { - storage.template store>(PIKA_FORWARD(Receiver, receiver)); + storage.template store>(std::forward(receiver)); return *this; } @@ -541,7 +541,7 @@ namespace pika::execution::experimental::detail { template friend auto tag_invoke( pika::execution::experimental::set_value_t, any_receiver&& r, Ts_&&... ts) noexcept - -> decltype(std::declval().set_value(PIKA_FORWARD(Ts_, ts)...)) + -> decltype(std::declval().set_value(std::forward(ts)...)) { // We first move the storage to a temporary variable so that // this any_receiver is empty after this set_value. Doing @@ -550,7 +550,7 @@ namespace pika::execution::experimental::detail { auto moved_storage = std::move(r.storage); try { - std::move(moved_storage.get()).set_value(PIKA_FORWARD(Ts_, ts)...); + std::move(moved_storage.get()).set_value(std::forward(ts)...); } catch (...) { @@ -649,7 +649,7 @@ namespace pika::execution::experimental::detail { typename = std::enable_if_t, unique_any_sender_impl>>> explicit unique_any_sender_impl(Sender_&& sender) - : sender(PIKA_FORWARD(Sender_, sender)) + : sender(std::forward(sender)) { } @@ -671,7 +671,7 @@ namespace pika::execution::experimental::detail { template , any_sender_impl>>> explicit any_sender_impl(Sender_&& sender) - : sender(PIKA_FORWARD(Sender_, sender)) + : sender(std::forward(sender)) { } @@ -747,14 +747,14 @@ namespace pika::execution::experimental { typename = std::enable_if_t, unique_any_sender>>> unique_any_sender(Sender&& sender) { - storage.template store>(PIKA_FORWARD(Sender, sender)); + storage.template store>(std::forward(sender)); } template , unique_any_sender>>> unique_any_sender& operator=(Sender&& sender) { - storage.template store>(PIKA_FORWARD(Sender, sender)); + storage.template store>(std::forward(sender)); return *this; } @@ -801,7 +801,7 @@ namespace pika::execution::experimental { // non-empty any_sender holding a moved-from sender. auto moved_storage = std::move(s.storage); return std::move(moved_storage.get()) - .connect(detail::any_receiver{PIKA_FORWARD(R, r)}); + .connect(detail::any_receiver{std::forward(r)}); } template @@ -822,7 +822,7 @@ namespace pika::execution::experimental { { *this = std::forward(sender); } - else { storage.template store>(PIKA_FORWARD(Sender, sender)); } + else { storage.template store>(std::forward(sender)); } } void reset() { storage.reset(); } @@ -861,7 +861,7 @@ namespace pika::execution::experimental { "any_sender requires the given sender to be copy constructible. Ensure the used " "sender type is copy constructible or use unique_any_sender if you do not require " "copyability."); - storage.template store>(PIKA_FORWARD(Sender, sender)); + storage.template store>(std::forward(sender)); } template >(PIKA_FORWARD(Sender, sender)); + storage.template store>(std::forward(sender)); return *this; } @@ -899,7 +899,7 @@ namespace pika::execution::experimental { friend detail::any_operation_state tag_invoke(pika::execution::experimental::connect_t, any_sender const& s, R&& r) { - return s.storage.get().connect(detail::any_receiver{PIKA_FORWARD(R, r)}); + return s.storage.get().connect(detail::any_receiver{std::forward(r)}); } template @@ -912,7 +912,7 @@ namespace pika::execution::experimental { // non-empty any_sender holding a moved-from sender. auto moved_storage = std::move(s.storage); return std::move(moved_storage.get()) - .connect(detail::any_receiver{PIKA_FORWARD(R, r)}); + .connect(detail::any_receiver{std::forward(r)}); } template @@ -928,7 +928,7 @@ namespace pika::execution::experimental { "any_sender requires the given sender to be copy constructible. Ensure the " "used sender type is copy constructible or use unique_any_sender if you do not " "require copyability."); - storage.template store>(PIKA_FORWARD(Sender, sender)); + storage.template store>(std::forward(sender)); } } diff --git a/libs/pika/executors/include/pika/executors/std_thread_scheduler.hpp b/libs/pika/executors/include/pika/executors/std_thread_scheduler.hpp index bf2c3db8b..f5e564275 100644 --- a/libs/pika/executors/include/pika/executors/std_thread_scheduler.hpp +++ b/libs/pika/executors/include/pika/executors/std_thread_scheduler.hpp @@ -30,7 +30,7 @@ namespace pika::execution::experimental { template friend void tag_invoke(execute_t, std_thread_scheduler const&, F&& f) { - std::thread t{PIKA_FORWARD(F, f)}; + std::thread t{std::forward(f)}; t.detach(); } @@ -43,7 +43,7 @@ namespace pika::execution::experimental { typename = std::enable_if_t< std::is_same_v, std::decay_t>>> operation_state(Receiver_&& receiver) - : receiver(PIKA_FORWARD(Receiver_, receiver)) + : receiver(std::forward(receiver)) { } operation_state(operation_state&&) = delete; @@ -87,7 +87,7 @@ namespace pika::execution::experimental { friend operation_state tag_invoke(connect_t, sender const&, Receiver&& receiver) { - return {PIKA_FORWARD(Receiver, receiver)}; + return {std::forward(receiver)}; } struct env diff --git a/libs/pika/executors/include/pika/executors/thread_pool_scheduler.hpp b/libs/pika/executors/include/pika/executors/thread_pool_scheduler.hpp index 474aee789..d93094708 100644 --- a/libs/pika/executors/include/pika/executors/thread_pool_scheduler.hpp +++ b/libs/pika/executors/include/pika/executors/thread_pool_scheduler.hpp @@ -126,7 +126,7 @@ namespace pika::execution::experimental { { pika::detail::thread_description desc(f, fallback_annotation); threads::detail::thread_init_data data( - threads::detail::make_thread_function_nullary(PIKA_FORWARD(F, f)), desc, priority_, + threads::detail::make_thread_function_nullary(std::forward(f)), desc, priority_, schedulehint_, stacksize_); threads::detail::register_work(data, pool_); } @@ -134,7 +134,7 @@ namespace pika::execution::experimental { template friend void tag_invoke(execute_t, thread_pool_scheduler const& sched, F&& f) { - sched.execute(PIKA_FORWARD(F, f), sched.get_fallback_annotation()); + sched.execute(std::forward(f), sched.get_fallback_annotation()); } template @@ -147,8 +147,8 @@ namespace pika::execution::experimental { template operation_state( Scheduler_&& scheduler, Receiver_&& receiver, char const* fallback_annotation) - : scheduler(PIKA_FORWARD(Scheduler_, scheduler)) - , receiver(PIKA_FORWARD(Receiver_, receiver)) + : scheduler(std::forward(scheduler)) + , receiver(std::forward(receiver)) , fallback_annotation(fallback_annotation) { PIKA_ASSERT(fallback_annotation != nullptr); @@ -205,7 +205,7 @@ namespace pika::execution::experimental { friend operation_state tag_invoke(connect_t, sender&& s, Receiver&& receiver) { - return {std::move(s.scheduler), PIKA_FORWARD(Receiver, receiver), + return {std::move(s.scheduler), std::forward(receiver), s.fallback_annotation}; } @@ -213,7 +213,7 @@ namespace pika::execution::experimental { friend operation_state tag_invoke(connect_t, sender const& s, Receiver&& receiver) { - return {s.scheduler, PIKA_FORWARD(Receiver, receiver), s.fallback_annotation}; + return {s.scheduler, std::forward(receiver), s.fallback_annotation}; } struct env @@ -271,7 +271,7 @@ namespace pika::execution::experimental { tag_invoke(schedule_from_t, thread_pool_scheduler&& scheduler, Sender&& predecessor_sender) { return schedule_from_detail::schedule_from_sender{ - PIKA_FORWARD(Sender, predecessor_sender), + std::forward(predecessor_sender), with_annotation(std::move(scheduler), scheduler.get_fallback_annotation())}; } @@ -280,7 +280,7 @@ namespace pika::execution::experimental { schedule_from_t, thread_pool_scheduler const& scheduler, Sender&& predecessor_sender) { return schedule_from_detail::schedule_from_sender{ - PIKA_FORWARD(Sender, predecessor_sender), + std::forward(predecessor_sender), with_annotation(scheduler, scheduler.get_fallback_annotation())}; } #endif diff --git a/libs/pika/executors/include/pika/executors/thread_pool_scheduler_bulk.hpp b/libs/pika/executors/include/pika/executors/thread_pool_scheduler_bulk.hpp index d9fa95bfc..bbccbab8d 100644 --- a/libs/pika/executors/include/pika/executors/thread_pool_scheduler_bulk.hpp +++ b/libs/pika/executors/include/pika/executors/thread_pool_scheduler_bulk.hpp @@ -72,9 +72,9 @@ namespace pika::thread_pool_bulk_detail { thread_pool_bulk_sender(pika::execution::experimental::thread_pool_scheduler&& scheduler, Sender_&& sender, Shape_&& shape, F_&& f) : scheduler(std::move(scheduler)) - , sender(PIKA_FORWARD(Sender_, sender)) - , shape(PIKA_FORWARD(Shape_, shape)) - , f(PIKA_FORWARD(F_, f)) + , sender(std::forward(sender)) + , shape(std::forward(shape)) + , f(std::forward(f)) { } thread_pool_bulk_sender(thread_pool_bulk_sender&&) = default; @@ -141,7 +141,7 @@ namespace pika::thread_pool_bulk_detail { pika::execution::experimental::set_error_t, bulk_receiver&& r, E&& e) noexcept { pika::execution::experimental::set_error( - std::move(r.op_state->receiver), PIKA_FORWARD(E, e)); + std::move(r.op_state->receiver), std::forward(e)); } friend void tag_invoke( @@ -230,7 +230,7 @@ namespace pika::thread_pool_bulk_detail { std::apply( pika::util::detail::bind_front(pika::execution::experimental::set_value, std::move(op_state->receiver)), - PIKA_FORWARD(Ts, ts)); + std::forward(ts)); } }; @@ -396,7 +396,7 @@ namespace pika::thread_pool_bulk_detail { if (r.op_state->shape == 0) { pika::execution::experimental::set_value( - std::move(r.op_state->receiver), PIKA_FORWARD(Ts, ts)...); + std::move(r.op_state->receiver), std::forward(ts)...); return; } @@ -407,7 +407,7 @@ namespace pika::thread_pool_bulk_detail { // Store sent values in the operation state r.op_state->ts.template emplace...>>( - PIKA_FORWARD(Ts, ts)...); + std::forward(ts)...); // Initialize the queues for all worker threads so that // worker threads can start stealing immediately when @@ -466,10 +466,10 @@ namespace pika::thread_pool_bulk_detail { Sender_&& sender, Shape_&& shape, F_&& f, Receiver_&& receiver) : scheduler(std::move(scheduler)) , op_state(pika::execution::experimental::connect( - PIKA_FORWARD(Sender_, sender), bulk_receiver{this})) - , shape(PIKA_FORWARD(Shape_, shape)) - , f(PIKA_FORWARD(F_, f)) - , receiver(PIKA_FORWARD(Receiver_, receiver)) + std::forward(sender), bulk_receiver{this})) + , shape(std::forward(shape)) + , f(std::forward(f)) + , receiver(std::forward(receiver)) { } @@ -487,7 +487,7 @@ namespace pika::thread_pool_bulk_detail { { return operation_state>{std::move(s.scheduler), std::move(s.sender), std::move(s.shape), std::move(s.f), - PIKA_FORWARD(Receiver, receiver)}; + std::forward(receiver)}; } template @@ -495,7 +495,7 @@ namespace pika::thread_pool_bulk_detail { Receiver&& receiver) { return operation_state>{ - s.scheduler, s.sender, s.shape, s.f, PIKA_FORWARD(Receiver, receiver)}; + s.scheduler, s.sender, s.shape, s.f, std::forward(receiver)}; } friend auto tag_invoke( @@ -514,6 +514,6 @@ namespace pika::execution::experimental { { return thread_pool_bulk_detail::thread_pool_bulk_sender, std::decay_t, std::decay_t>{std::move(scheduler), - PIKA_FORWARD(Sender, sender), PIKA_FORWARD(Shape, shape), PIKA_FORWARD(F, f)}; + std::forward(sender), std::forward(shape), std::forward(f)}; } } // namespace pika::execution::experimental diff --git a/libs/pika/functional/include/pika/functional/bind.hpp b/libs/pika/functional/include/pika/functional/bind.hpp index ed14c7119..20d500d1f 100644 --- a/libs/pika/functional/include/pika/functional/bind.hpp +++ b/libs/pika/functional/include/pika/functional/bind.hpp @@ -30,7 +30,7 @@ namespace pika::util::detail { static constexpr PIKA_HOST_DEVICE decltype(auto) call(T&& /*t*/, Us&&... vs) { return util::detail::member_pack_for( - std::piecewise_construct, PIKA_FORWARD(Us, vs)...) + std::piecewise_construct, std::forward(vs)...) .template get(); } }; @@ -41,7 +41,7 @@ namespace pika::util::detail { template static constexpr PIKA_HOST_DEVICE T&& call(T&& t, Us&&... /*vs*/) { - return PIKA_FORWARD(T, t); + return std::forward(t); } }; @@ -59,7 +59,7 @@ namespace pika::util::detail { template static constexpr PIKA_HOST_DEVICE std::invoke_result_t call(T&& t, Us&&... vs) { - return PIKA_INVOKE(PIKA_FORWARD(T, t), PIKA_FORWARD(Us, vs)...); + return PIKA_INVOKE(std::forward(t), std::forward(vs)...); } }; @@ -89,8 +89,8 @@ namespace pika::util::detail { template >> constexpr explicit bound(F_&& f, Ts_&&... vs) - : _f(PIKA_FORWARD(F_, f)) - , _args(std::piecewise_construct, PIKA_FORWARD(Ts_, vs)...) + : _f(std::forward(f)) + , _args(std::piecewise_construct, std::forward(vs)...) { } @@ -124,7 +124,7 @@ namespace pika::util::detail { { return PIKA_INVOKE(_f, detail::bind_eval::call( - _args.template get(), PIKA_FORWARD(Us, vs)...)...); + _args.template get(), std::forward(vs)...)...); } PIKA_NVCC_PRAGMA_HD_WARNING_DISABLE @@ -135,7 +135,7 @@ namespace pika::util::detail { { return PIKA_INVOKE(_f, detail::bind_eval::call( - _args.template get(), PIKA_FORWARD(Us, vs)...)...); + _args.template get(), std::forward(vs)...)...); } PIKA_NVCC_PRAGMA_HD_WARNING_DISABLE @@ -145,7 +145,7 @@ namespace pika::util::detail { { return PIKA_INVOKE(std::move(_f), detail::bind_eval::call( - std::move(_args).template get(), PIKA_FORWARD(Us, vs)...)...); + std::move(_args).template get(), std::forward(vs)...)...); } PIKA_NVCC_PRAGMA_HD_WARNING_DISABLE @@ -156,7 +156,7 @@ namespace pika::util::detail { { return PIKA_INVOKE(std::move(_f), detail::bind_eval::call( - std::move(_args).template get(), PIKA_FORWARD(Us, vs)...)...); + std::move(_args).template get(), std::forward(vs)...)...); } constexpr std::size_t get_function_address() const @@ -199,7 +199,7 @@ namespace pika::util::detail { using result_type = bound, util::detail::make_index_pack_t, ::pika::detail::decay_unwrap_t...>; - return result_type(PIKA_FORWARD(F, f), PIKA_FORWARD(Ts, vs)...); + return result_type(std::forward(f), std::forward(vs)...); } } // namespace pika::util::detail diff --git a/libs/pika/functional/include/pika/functional/bind_back.hpp b/libs/pika/functional/include/pika/functional/bind_back.hpp index 672f07d3a..566c80718 100644 --- a/libs/pika/functional/include/pika/functional/bind_back.hpp +++ b/libs/pika/functional/include/pika/functional/bind_back.hpp @@ -41,8 +41,8 @@ namespace pika::util::detail { template >> constexpr explicit bound_back(F_&& f, Ts_&&... vs) - : _f(PIKA_FORWARD(F_, f)) - , _args(std::piecewise_construct, PIKA_FORWARD(Ts_, vs)...) + : _f(std::forward(f)) + , _args(std::piecewise_construct, std::forward(vs)...) { } @@ -73,7 +73,7 @@ namespace pika::util::detail { typename invoke_bound_back_result, Us&&...>::type operator()(Us&&... vs) & { - return PIKA_INVOKE(_f, PIKA_FORWARD(Us, vs)..., _args.template get()...); + return PIKA_INVOKE(_f, std::forward(vs)..., _args.template get()...); } PIKA_NVCC_PRAGMA_HD_WARNING_DISABLE @@ -82,7 +82,7 @@ namespace pika::util::detail { util::detail::pack, Us&&...>::type operator()(Us&&... vs) const& { - return PIKA_INVOKE(_f, PIKA_FORWARD(Us, vs)..., _args.template get()...); + return PIKA_INVOKE(_f, std::forward(vs)..., _args.template get()...); } PIKA_NVCC_PRAGMA_HD_WARNING_DISABLE @@ -92,7 +92,7 @@ namespace pika::util::detail { operator()(Us&&... vs) && { return PIKA_INVOKE( - std::move(_f), PIKA_FORWARD(Us, vs)..., std::move(_args).template get()...); + std::move(_f), std::forward(vs)..., std::move(_args).template get()...); } PIKA_NVCC_PRAGMA_HD_WARNING_DISABLE @@ -102,7 +102,7 @@ namespace pika::util::detail { operator()(Us&&... vs) const&& { return PIKA_INVOKE( - std::move(_f), PIKA_FORWARD(Us, vs)..., std::move(_args).template get()...); + std::move(_f), std::forward(vs)..., std::move(_args).template get()...); } constexpr std::size_t get_function_address() const @@ -144,14 +144,14 @@ namespace pika::util::detail { using result_type = bound_back, util::detail::make_index_pack_t, ::pika::detail::decay_unwrap_t...>; - return result_type(PIKA_FORWARD(F, f), PIKA_FORWARD(Ts, vs)...); + return result_type(std::forward(f), std::forward(vs)...); } // nullary functions do not need to be bound again template constexpr std::decay_t bind_back(F&& f) { - return PIKA_FORWARD(F, f); + return std::forward(f); } } // namespace pika::util::detail diff --git a/libs/pika/functional/include/pika/functional/bind_front.hpp b/libs/pika/functional/include/pika/functional/bind_front.hpp index 3d2236064..921a83cc4 100644 --- a/libs/pika/functional/include/pika/functional/bind_front.hpp +++ b/libs/pika/functional/include/pika/functional/bind_front.hpp @@ -41,8 +41,8 @@ namespace pika::util::detail { template >> constexpr explicit bound_front(F_&& f, Ts_&&... vs) - : _f(PIKA_FORWARD(F_, f)) - , _args(std::piecewise_construct, PIKA_FORWARD(Ts_, vs)...) + : _f(std::forward(f)) + , _args(std::piecewise_construct, std::forward(vs)...) { } @@ -73,7 +73,7 @@ namespace pika::util::detail { typename invoke_bound_front_result, Us&&...>::type operator()(Us&&... vs) & { - return PIKA_INVOKE(_f, _args.template get()..., PIKA_FORWARD(Us, vs)...); + return PIKA_INVOKE(_f, _args.template get()..., std::forward(vs)...); } PIKA_NVCC_PRAGMA_HD_WARNING_DISABLE @@ -82,7 +82,7 @@ namespace pika::util::detail { util::detail::pack, Us&&...>::type operator()(Us&&... vs) const& { - return PIKA_INVOKE(_f, _args.template get()..., PIKA_FORWARD(Us, vs)...); + return PIKA_INVOKE(_f, _args.template get()..., std::forward(vs)...); } PIKA_NVCC_PRAGMA_HD_WARNING_DISABLE @@ -92,7 +92,7 @@ namespace pika::util::detail { operator()(Us&&... vs) && { return PIKA_INVOKE( - std::move(_f), std::move(_args).template get()..., PIKA_FORWARD(Us, vs)...); + std::move(_f), std::move(_args).template get()..., std::forward(vs)...); } PIKA_NVCC_PRAGMA_HD_WARNING_DISABLE @@ -102,7 +102,7 @@ namespace pika::util::detail { operator()(Us&&... vs) const&& { return PIKA_INVOKE( - std::move(_f), std::move(_args).template get()..., PIKA_FORWARD(Us, vs)...); + std::move(_f), std::move(_args).template get()..., std::forward(vs)...); } constexpr std::size_t get_function_address() const @@ -144,14 +144,14 @@ namespace pika::util::detail { using result_type = bound_front, typename util::detail::make_index_pack::type, std::decay_t...>; - return result_type(PIKA_FORWARD(F, f), PIKA_FORWARD(Ts, vs)...); + return result_type(std::forward(f), std::forward(vs)...); } // nullary functions do not need to be bound again template constexpr std::decay_t bind_front(F&& f) { - return PIKA_FORWARD(F, f); + return std::forward(f); } } // namespace pika::util::detail diff --git a/libs/pika/functional/include/pika/functional/deferred_call.hpp b/libs/pika/functional/include/pika/functional/deferred_call.hpp index 8aaa1ae9e..b758b8008 100644 --- a/libs/pika/functional/include/pika/functional/deferred_call.hpp +++ b/libs/pika/functional/include/pika/functional/deferred_call.hpp @@ -49,8 +49,8 @@ namespace pika::util::detail { template >> explicit constexpr PIKA_HOST_DEVICE deferred(F_&& f, Ts_&&... vs) - : _f(PIKA_FORWARD(F_, f)) - , _args(std::piecewise_construct, PIKA_FORWARD(Ts_, vs)...) + : _f(std::forward(f)) + , _args(std::piecewise_construct, std::forward(vs)...) { } @@ -116,7 +116,7 @@ namespace pika::util::detail { using result_type = deferred, util::detail::make_index_pack_t, ::pika::detail::decay_unwrap_t...>; - return result_type(PIKA_FORWARD(F, f), PIKA_FORWARD(Ts, vs)...); + return result_type(std::forward(f), std::forward(vs)...); } // nullary functions do not need to be bound again @@ -126,7 +126,7 @@ namespace pika::util::detail { static_assert( pika::detail::is_deferred_invocable_v, "F shall be Callable with no arguments"); - return PIKA_FORWARD(F, f); + return std::forward(f); } } // namespace pika::util::detail diff --git a/libs/pika/functional/include/pika/functional/detail/basic_function.hpp b/libs/pika/functional/include/pika/functional/detail/basic_function.hpp index dba81c703..bf93fef25 100644 --- a/libs/pika/functional/include/pika/functional/detail/basic_function.hpp +++ b/libs/pika/functional/include/pika/functional/detail/basic_function.hpp @@ -156,7 +156,7 @@ namespace pika::util::detail { vptr = f_vptr; buffer = vtable::template allocate(storage, function_storage_size); } - object = ::new (buffer) T(PIKA_FORWARD(F, f)); + object = ::new (buffer) T(std::forward(f)); } else { base_type::reset(get_empty_vtable()); } } @@ -196,7 +196,7 @@ namespace pika::util::detail { PIKA_FORCEINLINE R operator()(Ts... vs) const { vtable const* vptr = static_cast(base_type::vptr); - return vptr->invoke(object, PIKA_FORWARD(Ts, vs)...); + return vptr->invoke(object, std::forward(vs)...); } using base_type::get_function_address; diff --git a/libs/pika/functional/include/pika/functional/detail/vtable/callable_vtable.hpp b/libs/pika/functional/include/pika/functional/detail/vtable/callable_vtable.hpp index 426f24432..474745f3a 100644 --- a/libs/pika/functional/include/pika/functional/detail/vtable/callable_vtable.hpp +++ b/libs/pika/functional/include/pika/functional/detail/vtable/callable_vtable.hpp @@ -85,7 +85,7 @@ namespace pika::util::detail { template PIKA_FORCEINLINE static R _invoke(void* f, Ts&&... vs) { - return PIKA_INVOKE_R(R, vtable::get(f), PIKA_FORWARD(Ts, vs)...); + return PIKA_INVOKE_R(R, vtable::get(f), std::forward(vs)...); } R (*invoke)(void*, Ts&&...); diff --git a/libs/pika/functional/include/pika/functional/function.hpp b/libs/pika/functional/include/pika/functional/function.hpp index e535a82c1..6e3987a54 100644 --- a/libs/pika/functional/include/pika/functional/function.hpp +++ b/libs/pika/functional/include/pika/functional/function.hpp @@ -42,7 +42,7 @@ namespace pika::util::detail { typename Enable2 = std::enable_if_t>> function(F&& f) { - assign(PIKA_FORWARD(F, f)); + assign(std::forward(f)); } // the split SFINAE prevents MSVC from eagerly instantiating things @@ -51,7 +51,7 @@ namespace pika::util::detail { typename Enable2 = std::enable_if_t>> function& operator=(F&& f) { - assign(PIKA_FORWARD(F, f)); + assign(std::forward(f)); return *this; } diff --git a/libs/pika/functional/include/pika/functional/invoke.hpp b/libs/pika/functional/include/pika/functional/invoke.hpp index a9c75df20..f1a9c4f99 100644 --- a/libs/pika/functional/include/pika/functional/invoke.hpp +++ b/libs/pika/functional/include/pika/functional/invoke.hpp @@ -35,7 +35,7 @@ namespace pika::util::detail { template constexpr PIKA_HOST_DEVICE std::invoke_result_t invoke(F&& f, Ts&&... vs) { - return PIKA_INVOKE(PIKA_FORWARD(F, f), PIKA_FORWARD(Ts, vs)...); + return PIKA_INVOKE(std::forward(f), std::forward(vs)...); } /////////////////////////////////////////////////////////////////////////// @@ -46,6 +46,6 @@ namespace pika::util::detail { template constexpr PIKA_HOST_DEVICE R invoke_r(F&& f, Ts&&... vs) { - return PIKA_INVOKE_R(R, PIKA_FORWARD(F, f), PIKA_FORWARD(Ts, vs)...); + return PIKA_INVOKE_R(R, std::forward(f), std::forward(vs)...); } } // namespace pika::util::detail diff --git a/libs/pika/functional/include/pika/functional/one_shot.hpp b/libs/pika/functional/include/pika/functional/one_shot.hpp index 6459e84d8..ecd9ca989 100644 --- a/libs/pika/functional/include/pika/functional/one_shot.hpp +++ b/libs/pika/functional/include/pika/functional/one_shot.hpp @@ -24,7 +24,7 @@ namespace pika::util::detail { public: template >> constexpr explicit one_shot_wrapper(F_&& f) - : _f(PIKA_FORWARD(F_, f)) + : _f(std::forward(f)) #if defined(PIKA_DEBUG) , _called(false) #endif @@ -55,7 +55,7 @@ namespace pika::util::detail { { check_call(); - return PIKA_INVOKE(std::move(_f), PIKA_FORWARD(Ts, vs)...); + return PIKA_INVOKE(std::move(_f), std::forward(vs)...); } constexpr std::size_t get_function_address() const @@ -96,7 +96,7 @@ namespace pika::util::detail { { using result_type = one_shot_wrapper>; - return result_type(PIKA_FORWARD(F, f)); + return result_type(std::forward(f)); } } // namespace pika::util::detail diff --git a/libs/pika/functional/include/pika/functional/unique_function.hpp b/libs/pika/functional/include/pika/functional/unique_function.hpp index 43d861c17..1e9a6215b 100644 --- a/libs/pika/functional/include/pika/functional/unique_function.hpp +++ b/libs/pika/functional/include/pika/functional/unique_function.hpp @@ -40,7 +40,7 @@ namespace pika::util::detail { typename Enable2 = std::enable_if_t>> unique_function(F&& f) { - assign(PIKA_FORWARD(F, f)); + assign(std::forward(f)); } // the split SFINAE prevents MSVC from eagerly instantiating things @@ -49,7 +49,7 @@ namespace pika::util::detail { typename Enable2 = std::enable_if_t>> unique_function& operator=(F&& f) { - assign(PIKA_FORWARD(F, f)); + assign(std::forward(f)); return *this; } diff --git a/libs/pika/ini/src/ini.cpp b/libs/pika/ini/src/ini.cpp index 1522c8393..13492e594 100644 --- a/libs/pika/ini/src/ini.cpp +++ b/libs/pika/ini/src/ini.cpp @@ -574,8 +574,8 @@ namespace pika::detail { public: template compose_callback_impl(A1&& f1, A2&& f2) - : f1_(PIKA_FORWARD(A1, f1)) - , f2_(PIKA_FORWARD(A2, f2)) + : f1_(std::forward(f1)) + , f2_(std::forward(f2)) { } @@ -595,13 +595,13 @@ namespace pika::detail { compose_callback(F1&& f1, F2&& f2) { if (!f1) - return PIKA_FORWARD(F2, f2); + return std::forward(f2); else if (!f2) - return PIKA_FORWARD(F1, f1); + return std::forward(f1); // otherwise create a combined callback using result_type = compose_callback_impl, std::decay_t>; - return result_type(PIKA_FORWARD(F1, f1), PIKA_FORWARD(F2, f2)); + return result_type(std::forward(f1), std::forward(f2)); } void section::add_notification_callback( diff --git a/libs/pika/iterator_support/include/pika/iterator_support/zip_iterator.hpp b/libs/pika/iterator_support/include/pika/iterator_support/zip_iterator.hpp index c428e83ad..df2c7a292 100644 --- a/libs/pika/iterator_support/include/pika/iterator_support/zip_iterator.hpp +++ b/libs/pika/iterator_support/include/pika/iterator_support/zip_iterator.hpp @@ -306,7 +306,7 @@ namespace pika::util { template PIKA_HOST_DEVICE void apply(F&& f) { - return apply(PIKA_FORWARD(F, f), + return apply(std::forward(f), util::detail::make_index_pack::value>()); } @@ -455,7 +455,7 @@ namespace pika::util { { using result_type = zip_iterator...>; - return result_type(PIKA_FORWARD(Ts, vs)...); + return result_type(std::forward(vs)...); } /////////////////////////////////////////////////////////////////////////// diff --git a/libs/pika/properties/include/pika/property.hpp b/libs/pika/properties/include/pika/property.hpp index 397172ca1..a07a82c9d 100644 --- a/libs/pika/properties/include/pika/property.hpp +++ b/libs/pika/properties/include/pika/property.hpp @@ -20,26 +20,26 @@ namespace pika::experimental { template friend constexpr PIKA_FORCEINLINE auto tag_fallback_invoke( prefer_t, Tag const& tag, Tn&&... tn) - noexcept(noexcept(tag(PIKA_FORWARD(Tn, tn)...))) - -> decltype(tag(PIKA_FORWARD(Tn, tn)...)) + noexcept(noexcept(tag(std::forward( tn)...))) + -> decltype(tag(std::forward( tn)...)) // clang-format on { - return tag(PIKA_FORWARD(Tn, tn)...); + return tag(std::forward(tn)...); } // clang-format off template friend constexpr PIKA_FORCEINLINE auto tag_fallback_invoke( prefer_t, Tag, T0&& t0, Tn&&...) - noexcept(noexcept(PIKA_FORWARD(T0, t0))) + noexcept(noexcept(std::forward( t0))) -> std::enable_if_t< !pika::functional::detail::is_tag_invocable_v< prefer_t, Tag, T0, Tn...> && !std::is_invocable_v, - decltype(PIKA_FORWARD(T0, t0))> + decltype(std::forward( t0))> // clang-format on { - return PIKA_FORWARD(T0, t0); + return std::forward(t0); } } prefer{}; } // namespace pika::experimental diff --git a/libs/pika/string_util/include/pika/string_util/from_string.hpp b/libs/pika/string_util/include/pika/string_util/from_string.hpp index cc592934d..69020b777 100644 --- a/libs/pika/string_util/include/pika/string_util/from_string.hpp +++ b/libs/pika/string_util/include/pika/string_util/from_string.hpp @@ -182,7 +182,7 @@ namespace pika::detail { } catch (...) { - return PIKA_FORWARD(U, default_value); + return std::forward(default_value); } } @@ -212,7 +212,7 @@ namespace pika::detail { } catch (...) { - return PIKA_FORWARD(U, default_value); + return std::forward(default_value); } } } // namespace pika::detail diff --git a/libs/pika/string_util/include/pika/string_util/split.hpp b/libs/pika/string_util/include/pika/string_util/split.hpp index 6e8cf0475..d52e425a5 100644 --- a/libs/pika/string_util/include/pika/string_util/split.hpp +++ b/libs/pika/string_util/include/pika/string_util/split.hpp @@ -7,8 +7,6 @@ #pragma once -#include - #include #include #include @@ -60,6 +58,6 @@ namespace pika::detail { void split(Container& container, char const* str, Predicate&& pred, token_compress_mode compress_mode = token_compress_mode::off) { - split(container, std::string{str}, PIKA_FORWARD(Predicate, pred), compress_mode); + split(container, std::string{str}, std::forward(pred), compress_mode); } } // namespace pika::detail diff --git a/libs/pika/synchronization/include/pika/synchronization/async_rw_mutex.hpp b/libs/pika/synchronization/include/pika/synchronization/async_rw_mutex.hpp index daf11a452..9b011637a 100644 --- a/libs/pika/synchronization/include/pika/synchronization/async_rw_mutex.hpp +++ b/libs/pika/synchronization/include/pika/synchronization/async_rw_mutex.hpp @@ -78,7 +78,7 @@ namespace pika::execution::experimental { void set_value(U&& u) { PIKA_ASSERT(!value); - value.emplace(PIKA_FORWARD(U, u)); + value.emplace(std::forward(u)); value_set.store(true, std::memory_order_release); } @@ -103,7 +103,7 @@ namespace pika::execution::experimental { void add_continuation(F&& continuation) { std::lock_guard l(mtx); - continuations.emplace_back(PIKA_FORWARD(F, continuation)); + continuations.emplace_back(std::forward(continuation)); } }; @@ -144,7 +144,7 @@ namespace pika::execution::experimental { void add_continuation(F&& continuation) { std::lock_guard l(mtx); - continuations.emplace_back(PIKA_FORWARD(F, continuation)); + continuations.emplace_back(std::forward(continuation)); } }; } // namespace detail @@ -422,7 +422,7 @@ namespace pika::execution::experimental { template operation_state( R_&& r, shared_state_weak_ptr_type prev_state, shared_state_ptr_type state) - : r(PIKA_FORWARD(R_, r)) + : r(std::forward(r)) , prev_state(std::move(prev_state)) , state(std::move(state)) { @@ -476,7 +476,7 @@ namespace pika::execution::experimental { friend auto tag_invoke(pika::execution::experimental::connect_t, sender&& s, R&& r) { return operation_state{ - PIKA_FORWARD(R, r), std::move(s.prev_state), std::move(s.state)}; + std::forward(r), std::move(s.prev_state), std::move(s.state)}; } }; @@ -518,7 +518,7 @@ namespace pika::execution::experimental { template , async_rw_mutex>::value>> explicit async_rw_mutex(U&& u, allocator_type const& alloc = {}) - : value(PIKA_FORWARD(U, u)) + : value(std::forward(u)) , alloc(alloc) { } @@ -614,7 +614,7 @@ namespace pika::execution::experimental { template operation_state( R_&& r, shared_state_weak_ptr_type prev_state, shared_state_ptr_type state) - : r(PIKA_FORWARD(R_, r)) + : r(std::forward(r)) , prev_state(std::move(prev_state)) , state(std::move(state)) { @@ -668,7 +668,7 @@ namespace pika::execution::experimental { friend auto tag_invoke(pika::execution::experimental::connect_t, sender&& s, R&& r) { return operation_state{ - PIKA_FORWARD(R, r), std::move(s.prev_state), std::move(s.state)}; + std::forward(r), std::move(s.prev_state), std::move(s.state)}; } template @@ -681,7 +681,7 @@ namespace pika::execution::experimental { "connectable"); } - return operation_state{PIKA_FORWARD(R, r), s.prev_state, s.state}; + return operation_state{std::forward(r), s.prev_state, s.state}; } }; diff --git a/libs/pika/synchronization/include/pika/synchronization/once.hpp b/libs/pika/synchronization/include/pika/synchronization/once.hpp index bb62035ac..6a70c9b17 100644 --- a/libs/pika/synchronization/include/pika/synchronization/once.hpp +++ b/libs/pika/synchronization/include/pika/synchronization/once.hpp @@ -59,7 +59,7 @@ namespace pika { // wrapped function was throwing an exception before flag.event_.reset(); - PIKA_INVOKE(PIKA_FORWARD(F, f), PIKA_FORWARD(Args, args)...); + PIKA_INVOKE(std::forward(f), std::forward(args)...); // set status to done, release waiting threads flag.status_.store(function_complete_flag_value); diff --git a/libs/pika/synchronization/include/pika/synchronization/stop_token.hpp b/libs/pika/synchronization/include/pika/synchronization/stop_token.hpp index 37b52c8c0..5252b7178 100644 --- a/libs/pika/synchronization/include/pika/synchronization/stop_token.hpp +++ b/libs/pika/synchronization/include/pika/synchronization/stop_token.hpp @@ -412,15 +412,15 @@ namespace pika { // // Preconditions: Callback and CB model constructible_from. // - // Effects: Initializes callback with PIKA_FORWARD(CB, cb). If - // st.stop_requested() is true, then PIKA_FORWARD(CB, cb)() is + // Effects: Initializes callback with std::forward( cb). If + // st.stop_requested() is true, then std::forward( cb)() is // evaluated in the current thread before the constructor returns. // Otherwise, if st has ownership of a stop state, acquires shared // ownership of that stop state and registers the callback with - // that stop state such that PIKA_FORWARD(CB, cb)() is evaluated by + // that stop state such that std::forward( cb)() is evaluated by // the first call to request_stop() on an associated stop_source. // - // Remarks: If evaluating PIKA_FORWARD(CB, cb)() exits via + // Remarks: If evaluating std::forward( cb)() exits via // an exception, then std::terminate is called (14.6.1). // // Throws: Any exception thrown by the initialization of callback. @@ -429,7 +429,7 @@ namespace pika { typename std::enable_if::value>::type> explicit stop_callback(stop_token const& st, CB&& cb) noexcept( std::is_nothrow_constructible::value) - : callback_(PIKA_FORWARD(CB, cb)) + : callback_(std::forward(cb)) , state_(st.state_) { if (state_) state_->add_callback(this); @@ -440,7 +440,7 @@ namespace pika { typename std::enable_if::value>::type> explicit stop_callback(stop_token&& st, CB&& cb) noexcept( std::is_nothrow_constructible::value) - : callback_(PIKA_FORWARD(CB, cb)) + : callback_(std::forward(cb)) , state_(std::move(st.state_)) { if (state_) state_->add_callback(this); @@ -486,13 +486,13 @@ namespace pika { template stop_callback> make_stop_callback(stop_token const& st, Callback&& cb) { - return stop_callback>(st, PIKA_FORWARD(Callback, cb)); + return stop_callback>(st, std::forward(cb)); } template stop_callback> make_stop_callback(stop_token&& st, Callback&& cb) { - return stop_callback>(std::move(st), PIKA_FORWARD(Callback, cb)); + return stop_callback>(std::move(st), std::forward(cb)); } // clang-format produces inconsistent result between different versions diff --git a/libs/pika/tag_invoke/include/pika/functional/detail/invoke.hpp b/libs/pika/tag_invoke/include/pika/functional/detail/invoke.hpp index e19d80d7f..786c5c043 100644 --- a/libs/pika/tag_invoke/include/pika/functional/detail/invoke.hpp +++ b/libs/pika/tag_invoke/include/pika/functional/detail/invoke.hpp @@ -21,7 +21,7 @@ namespace pika::util::detail { std::is_base_of::type>::value>::type> static constexpr T&& mem_ptr_target(T&& v) noexcept { - return PIKA_FORWARD(T, v); + return std::forward(v); } // when `pm` is a pointer to member of a class `C` and @@ -39,13 +39,13 @@ namespace pika::util::detail { #if defined(PIKA_CUDA_VERSION) noexcept(*std::forward(v))) -> decltype(*std::forward(v)) #else - noexcept(*PIKA_FORWARD(T, v))) -> decltype(*PIKA_FORWARD(T, v)) + noexcept(*std::forward(v))) -> decltype(*std::forward(v)) #endif { #if defined(PIKA_CUDA_VERSION) return *std::forward(v); #else - return *PIKA_FORWARD(T, v); + return *std::forward(v); #endif } @@ -63,8 +63,8 @@ namespace pika::util::detail { template constexpr auto operator()(T1&& t1) const - noexcept(noexcept(detail::mem_ptr_target(PIKA_FORWARD(T1, t1)).*pm)) - -> decltype(detail::mem_ptr_target(PIKA_FORWARD(T1, t1)).*pm) + noexcept(noexcept(detail::mem_ptr_target(std::forward(t1)).* + pm)) -> decltype(detail::mem_ptr_target(std::forward(t1)).*pm) { // This seems to trigger a bogus warning in GCC 11 with // optimizations enabled (possibly the same as this: @@ -74,7 +74,7 @@ namespace pika::util::detail { # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Warray-bounds" #endif - return detail::mem_ptr_target(PIKA_FORWARD(T1, t1)).*pm; + return detail::mem_ptr_target(std::forward(t1)).*pm; #if defined(PIKA_GCC_VERSION) && PIKA_GCC_VERSION >= 110000 # pragma GCC diagnostic pop #endif @@ -93,10 +93,10 @@ namespace pika::util::detail { } template - constexpr auto operator()(T1&& t1, Tn&&... tn) const noexcept(noexcept( - (detail::mem_ptr_target(PIKA_FORWARD(T1, t1)).*pm)(PIKA_FORWARD(Tn, tn)...))) - -> decltype((detail::mem_ptr_target(PIKA_FORWARD(T1, t1)).*pm)( - PIKA_FORWARD(Tn, tn)...)) + constexpr auto operator()(T1&& t1, Tn&&... tn) const noexcept( + noexcept((detail::mem_ptr_target(std::forward(t1)).*pm)(std::forward( + tn)...))) -> decltype((detail::mem_ptr_target(std::forward(t1)).* + pm)(std::forward(tn)...)) { // This seems to trigger a bogus warning in GCC 11 with // optimizations enabled (possibly the same as this: @@ -106,7 +106,7 @@ namespace pika::util::detail { # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Warray-bounds" #endif - return (detail::mem_ptr_target(PIKA_FORWARD(T1, t1)).*pm)(PIKA_FORWARD(Tn, tn)...); + return (detail::mem_ptr_target(std::forward(t1)).*pm)(std::forward(tn)...); #if defined(PIKA_GCC_VERSION) && PIKA_GCC_VERSION >= 110000 # pragma GCC diagnostic pop #endif diff --git a/libs/pika/tag_invoke/include/pika/functional/detail/tag_fallback_invoke.hpp b/libs/pika/tag_invoke/include/pika/functional/detail/tag_fallback_invoke.hpp index 67dc8a206..cf63f38e7 100644 --- a/libs/pika/tag_invoke/include/pika/functional/detail/tag_fallback_invoke.hpp +++ b/libs/pika/tag_invoke/include/pika/functional/detail/tag_fallback_invoke.hpp @@ -19,7 +19,7 @@ namespace pika::functional::detail { /// The evaluation of the expression /// `pika::functional::detail::tag_fallback_invoke(tag, args...)` is /// equivalent to evaluating the unqualified call to - /// `tag_fallback_invoke(decay-copy(tag), PIKA_FORWARD(Args, args)...)`. + /// `tag_fallback_invoke(decay-copy(tag), std::forward( args)...)`. /// /// `pika::functional::detail::tag_fallback_invoke` is implemented against P1895. /// @@ -119,10 +119,10 @@ namespace pika::functional::detail { template PIKA_HOST_DEVICE PIKA_FORCEINLINE constexpr auto PIKA_STATIC_CALL_OPERATOR(Tag tag, Ts&&... ts) noexcept( - noexcept(tag_fallback_invoke(std::declval(), PIKA_FORWARD(Ts, ts)...))) - -> decltype(tag_fallback_invoke(std::declval(), PIKA_FORWARD(Ts, ts)...)) + noexcept(tag_fallback_invoke(std::declval(), std::forward(ts)...))) + -> decltype(tag_fallback_invoke(std::declval(), std::forward(ts)...)) { - return tag_fallback_invoke(tag, PIKA_FORWARD(Ts, ts)...); + return tag_fallback_invoke(tag, std::forward(ts)...); } friend constexpr bool operator==(tag_fallback_invoke_t, tag_fallback_invoke_t) @@ -249,11 +249,11 @@ namespace pika::functional::detail { PIKA_NVCC_PRAGMA_HD_WARNING_DISABLE template >> - PIKA_HOST_DEVICE PIKA_FORCEINLINE constexpr auto PIKA_STATIC_CALL_OPERATOR( - Args&&... args) noexcept(is_nothrow_tag_invocable_v) - -> tag_invoke_result_t + PIKA_HOST_DEVICE PIKA_FORCEINLINE constexpr auto + PIKA_STATIC_CALL_OPERATOR(Args&&... args) noexcept( + is_nothrow_tag_invocable_v) -> tag_invoke_result_t { - return tag_invoke(Tag{}, PIKA_FORWARD(Args, args)...); + return tag_invoke(Tag{}, std::forward(args)...); } // is not tag-dispatchable @@ -264,7 +264,7 @@ namespace pika::functional::detail { Args&&... args) noexcept(is_nothrow_tag_fallback_invocable_v) -> tag_fallback_invoke_result_t { - return tag_fallback_invoke(Tag{}, PIKA_FORWARD(Args, args)...); + return tag_fallback_invoke(Tag{}, std::forward(args)...); } }; @@ -287,10 +287,10 @@ namespace pika::functional::detail { PIKA_NVCC_PRAGMA_HD_WARNING_DISABLE template PIKA_HOST_DEVICE PIKA_FORCEINLINE constexpr static auto - tag_fallback_invoke_impl(std::true_type, Args&&... args) noexcept - -> tag_fallback_invoke_result_t + tag_fallback_invoke_impl(std::true_type, + Args&&... args) noexcept -> tag_fallback_invoke_result_t { - return tag_fallback_invoke(Tag{}, PIKA_FORWARD(Args, args)...); + return tag_fallback_invoke(Tag{}, std::forward(args)...); } public: @@ -301,7 +301,7 @@ namespace pika::functional::detail { PIKA_HOST_DEVICE PIKA_FORCEINLINE constexpr auto PIKA_STATIC_CALL_OPERATOR( Args&&... args) noexcept -> tag_invoke_result_t { - return tag_invoke(Tag{}, PIKA_FORWARD(Args, args)...); + return tag_invoke(Tag{}, std::forward(args)...); } // is not nothrow tag-dispatchable @@ -311,10 +311,11 @@ namespace pika::functional::detail { typename Enable = std::enable_if_t>> PIKA_HOST_DEVICE PIKA_FORCEINLINE constexpr auto PIKA_STATIC_CALL_OPERATOR(Args&&... args) noexcept -> decltype(tag_fallback_invoke_impl( - IsFallbackDispatchable{}, PIKA_FORWARD(Args, args)...)) + IsFallbackDispatchable{}, + std::forward(args)...)) { return tag_fallback_invoke_impl( - IsFallbackDispatchable{}, PIKA_FORWARD(Args, args)...); + IsFallbackDispatchable{}, std::forward(args)...); } }; } // namespace tag_base_ns diff --git a/libs/pika/tag_invoke/include/pika/functional/detail/tag_priority_invoke.hpp b/libs/pika/tag_invoke/include/pika/functional/detail/tag_priority_invoke.hpp index 89c687a01..3c2358eb9 100644 --- a/libs/pika/tag_invoke/include/pika/functional/detail/tag_priority_invoke.hpp +++ b/libs/pika/tag_invoke/include/pika/functional/detail/tag_priority_invoke.hpp @@ -20,7 +20,7 @@ namespace pika::functional::detail { /// The evaluation of the expression /// `pika::functional::detail::tag_override_invoke(tag, args...)` is /// equivalent to evaluating the unqualified call to - /// `tag_override_invoke(decay-copy(tag), PIKA_FORWARD(Args, args)...)`. + /// `tag_override_invoke(decay-copy(tag), std::forward( args)...)`. /// /// `pika::functional::detail::tag_override_invoke` is implemented against P1895. /// @@ -122,10 +122,10 @@ namespace pika::functional::detail { template PIKA_HOST_DEVICE PIKA_FORCEINLINE constexpr auto PIKA_STATIC_CALL_OPERATOR(Tag tag, Ts&&... ts) noexcept( - noexcept(tag_override_invoke(std::declval(), PIKA_FORWARD(Ts, ts)...))) - -> decltype(tag_override_invoke(std::declval(), PIKA_FORWARD(Ts, ts)...)) + noexcept(tag_override_invoke(std::declval(), std::forward(ts)...))) + -> decltype(tag_override_invoke(std::declval(), std::forward(ts)...)) { - return tag_override_invoke(tag, PIKA_FORWARD(Ts, ts)...); + return tag_override_invoke(tag, std::forward(ts)...); } friend constexpr bool operator==(tag_override_invoke_t, tag_override_invoke_t) @@ -235,7 +235,7 @@ namespace pika::functional::detail { Args&&... args) noexcept(is_nothrow_tag_override_invocable_v) -> tag_override_invoke_result_t { - return tag_override_invoke(Tag{}, PIKA_FORWARD(Args, args)...); + return tag_override_invoke(Tag{}, std::forward(args)...); } // Is not tag-override-dispatchable, but tag-dispatchable @@ -243,11 +243,11 @@ namespace pika::functional::detail { template && is_tag_invocable_v>> - PIKA_HOST_DEVICE PIKA_FORCEINLINE constexpr auto PIKA_STATIC_CALL_OPERATOR( - Args&&... args) noexcept(is_nothrow_tag_invocable_v) - -> tag_invoke_result_t + PIKA_HOST_DEVICE PIKA_FORCEINLINE constexpr auto + PIKA_STATIC_CALL_OPERATOR(Args&&... args) noexcept( + is_nothrow_tag_invocable_v) -> tag_invoke_result_t { - return tag_invoke(Tag{}, PIKA_FORWARD(Args, args)...); + return tag_invoke(Tag{}, std::forward(args)...); } // Is not tag-override-dispatchable, not tag-dispatchable, but @@ -261,7 +261,7 @@ namespace pika::functional::detail { Args&&... args) noexcept(is_nothrow_tag_fallback_invocable_v) -> tag_fallback_invoke_result_t { - return tag_fallback_invoke(Tag{}, PIKA_FORWARD(Args, args)...); + return tag_fallback_invoke(Tag{}, std::forward(args)...); } }; @@ -281,7 +281,7 @@ namespace pika::functional::detail { PIKA_HOST_DEVICE PIKA_FORCEINLINE constexpr auto PIKA_STATIC_CALL_OPERATOR( Args&&... args) noexcept -> tag_override_invoke_result_t { - return tag_override_invoke(Tag{}, PIKA_FORWARD(Args, args)...); + return tag_override_invoke(Tag{}, std::forward(args)...); } // Is not nothrow tag-override-dispatchable, but nothrow @@ -294,7 +294,7 @@ namespace pika::functional::detail { PIKA_HOST_DEVICE PIKA_FORCEINLINE constexpr auto PIKA_STATIC_CALL_OPERATOR( Args&&... args) noexcept -> tag_invoke_result_t { - return tag_invoke(Tag{}, PIKA_FORWARD(Args, args)...); + return tag_invoke(Tag{}, std::forward(args)...); } // Is not nothrow tag-override-dispatchable, not nothrow @@ -308,7 +308,7 @@ namespace pika::functional::detail { PIKA_HOST_DEVICE PIKA_FORCEINLINE constexpr auto PIKA_STATIC_CALL_OPERATOR( Args&&... args) noexcept -> tag_fallback_invoke_result_t { - return tag_fallback_invoke(Tag{}, PIKA_FORWARD(Args, args)...); + return tag_fallback_invoke(Tag{}, std::forward(args)...); } }; } // namespace tag_base_ns diff --git a/libs/pika/tag_invoke/include/pika/functional/tag_invoke.hpp b/libs/pika/tag_invoke/include/pika/functional/tag_invoke.hpp index 4d55b4ed8..e25188c82 100644 --- a/libs/pika/tag_invoke/include/pika/functional/tag_invoke.hpp +++ b/libs/pika/tag_invoke/include/pika/functional/tag_invoke.hpp @@ -17,7 +17,7 @@ namespace pika::functional::detail { /// /// The evaluation of the expression `pika::tag_invoke(tag, args...)` is /// equivalent to evaluating the unqualified call to - /// `tag_invoke(decay-copy(tag), PIKA_FORWARD(Args, args)...)`. + /// `tag_invoke(decay-copy(tag), std::forward( args)...)`. /// /// `pika::functional::detail::tag_invoke` is implemented against P1895. /// @@ -117,10 +117,10 @@ namespace pika::functional::detail { template PIKA_HOST_DEVICE PIKA_FORCEINLINE constexpr auto PIKA_STATIC_CALL_OPERATOR(Tag tag, Ts&&... ts) noexcept( - noexcept(tag_invoke(std::declval(), PIKA_FORWARD(Ts, ts)...))) - -> decltype(tag_invoke(std::declval(), PIKA_FORWARD(Ts, ts)...)) + noexcept(tag_invoke(std::declval(), std::forward(ts)...))) + -> decltype(tag_invoke(std::declval(), std::forward(ts)...)) { - return tag_invoke(tag, PIKA_FORWARD(Ts, ts)...); + return tag_invoke(tag, std::forward(ts)...); } friend constexpr bool operator==(tag_invoke_t, tag_invoke_t) { return true; } @@ -204,11 +204,11 @@ namespace pika::functional::detail { { PIKA_NVCC_PRAGMA_HD_WARNING_DISABLE template - PIKA_HOST_DEVICE PIKA_FORCEINLINE constexpr auto PIKA_STATIC_CALL_OPERATOR( - Args&&... args) noexcept(is_nothrow_tag_invocable_v) - -> tag_invoke_result_t + PIKA_HOST_DEVICE PIKA_FORCEINLINE constexpr auto + PIKA_STATIC_CALL_OPERATOR(Args&&... args) noexcept( + is_nothrow_tag_invocable_v) -> tag_invoke_result_t { - return tag_invoke(Tag{}, PIKA_FORWARD(Args, args)...); + return tag_invoke(Tag{}, std::forward(args)...); } }; @@ -221,7 +221,7 @@ namespace pika::functional::detail { PIKA_HOST_DEVICE PIKA_FORCEINLINE constexpr auto PIKA_STATIC_CALL_OPERATOR( Args&&... args) noexcept -> tag_invoke_result_t { - return tag_invoke(Tag{}, PIKA_FORWARD(Args, args)...); + return tag_invoke(Tag{}, std::forward(args)...); } }; } // namespace tag_base_ns diff --git a/libs/pika/threading/include/pika/threading/jthread.hpp b/libs/pika/threading/include/pika/threading/jthread.hpp index 8bf1d8cd4..68949425e 100644 --- a/libs/pika/threading/include/pika/threading/jthread.hpp +++ b/libs/pika/threading/include/pika/threading/jthread.hpp @@ -24,14 +24,14 @@ namespace pika { static void invoke(std::false_type, F&& f, stop_token&& /* st */, Ts&&... ts) { // started thread does not expect a stop token: - PIKA_INVOKE(PIKA_FORWARD(F, f), PIKA_FORWARD(Ts, ts)...); + PIKA_INVOKE(std::forward(f), std::forward(ts)...); } template static void invoke(std::true_type, F&& f, stop_token&& st, Ts&&... ts) { // pass the stop_token as first argument to the started thread: - PIKA_INVOKE(PIKA_FORWARD(F, f), std::move(st), PIKA_FORWARD(Ts, ts)...); + PIKA_INVOKE(std::forward(f), std::move(st), std::forward(ts)...); } public: @@ -54,13 +54,13 @@ namespace pika { // Requires: F and each T in Ts meet the Cpp17MoveConstructible // requirements. Either // - // INVOKE(decay-copy(PIKA_FORWARD(F, f)), get_stop_token(), - // decay-copy(PIKA_FORWARD(Ts, ts))...) + // INVOKE(decay-copy(std::forward( f)), get_stop_token(), + // decay-copy(std::forward( ts))...) // // is a valid expression or // - // INVOKE(decay-copy(PIKA_FORWARD(F, f)), - // decay-copy(PIKA_FORWARD(Ts, ts))...) + // INVOKE(decay-copy(std::forward( f)), + // decay-copy(std::forward( ts))...) // // is a valid expression. // @@ -69,13 +69,13 @@ namespace pika { // Effects: Initializes ssource_ and constructs an object of type // jthread. The new thread of execution executes // - // INVOKE(decay-copy(PIKA_FORWARD(F, f)), get_stop_token(), - // decay-copy(PIKA_FORWARD(Ts, ts))...) + // INVOKE(decay-copy(std::forward( f)), get_stop_token(), + // decay-copy(std::forward( ts))...) // // if that expression is well-formed, otherwise // - // INVOKE(decay-copy(PIKA_FORWARD(F, f)), - // decay-copy(PIKA_FORWARD(Ts, ts))...) + // INVOKE(decay-copy(std::forward( f)), + // decay-copy(std::forward( ts))...) // // with the calls to decay-copy being evaluated in the // constructing thread. Any return value from this invocation @@ -108,12 +108,12 @@ namespace pika { // perform tasks of the thread using use_stop_token = typename std::is_invocable::type; - jthread::invoke(use_stop_token{}, PIKA_FORWARD(F, f), std::move(st), - PIKA_FORWARD(Ts, ts)...); + jthread::invoke(use_stop_token{}, std::forward(f), std::move(st), + std::forward(ts)...); }, // not captured due to possible races if immediately set - ssource_.get_token(), PIKA_FORWARD(F, f), // pass callable - PIKA_FORWARD(Ts, ts)... // pass arguments for callable + ssource_.get_token(), std::forward(f), // pass callable + std::forward(ts)... // pass arguments for callable } { } diff --git a/libs/pika/threading/include/pika/threading/thread.hpp b/libs/pika/threading/include/pika/threading/thread.hpp index 63d17afc6..f97d76c95 100644 --- a/libs/pika/threading/include/pika/threading/thread.hpp +++ b/libs/pika/threading/include/pika/threading/thread.hpp @@ -56,7 +56,7 @@ namespace pika { auto thrd_data = pika::threads::detail::get_self_id_data(); PIKA_ASSERT(thrd_data); start_thread(thrd_data->get_scheduler_base()->get_parent_pool(), - util::detail::deferred_call(PIKA_FORWARD(F, f))); + util::detail::deferred_call(std::forward(f))); } template @@ -65,20 +65,20 @@ namespace pika { auto thrd_data = pika::threads::detail::get_self_id_data(); PIKA_ASSERT(thrd_data); start_thread(thrd_data->get_scheduler_base()->get_parent_pool(), - util::detail::deferred_call(PIKA_FORWARD(F, f), PIKA_FORWARD(Ts, vs)...)); + util::detail::deferred_call(std::forward(f), std::forward(vs)...)); } template thread(threads::detail::thread_pool_base* pool, F&& f) { - start_thread(pool, util::detail::deferred_call(PIKA_FORWARD(F, f))); + start_thread(pool, util::detail::deferred_call(std::forward(f))); } template thread(threads::detail::thread_pool_base* pool, F&& f, Ts&&... vs) { start_thread( - pool, util::detail::deferred_call(PIKA_FORWARD(F, f), PIKA_FORWARD(Ts, vs)...)); + pool, util::detail::deferred_call(std::forward(f), std::forward(vs)...)); } ~thread(); diff --git a/libs/pika/threading_base/include/pika/threading_base/annotated_function.hpp b/libs/pika/threading_base/include/pika/threading_base/annotated_function.hpp index 2a488b069..38be5eee5 100644 --- a/libs/pika/threading_base/include/pika/threading_base/annotated_function.hpp +++ b/libs/pika/threading_base/include/pika/threading_base/annotated_function.hpp @@ -60,7 +60,7 @@ namespace pika { std::invoke_result_t operator()(Ts&&... ts) { scoped_annotation annotate(get_function_annotation()); - return PIKA_INVOKE(f_, PIKA_FORWARD(Ts, ts)...); + return PIKA_INVOKE(f_, std::forward(ts)...); } /////////////////////////////////////////////////////////////////// @@ -100,7 +100,7 @@ namespace pika { { using result_type = detail::annotated_function>; - return result_type(PIKA_FORWARD(F, f), name); + return result_type(std::forward(f), name); } template @@ -111,7 +111,7 @@ namespace pika { // Store string in a set to ensure it lives for the entire duration of // the task. char const* name_c_str = pika::detail::store_function_annotation(std::move(name)); - return result_type(PIKA_FORWARD(F, f), name_c_str); + return result_type(std::forward(f), name_c_str); } #else @@ -124,13 +124,13 @@ namespace pika { template constexpr F&& annotated_function(F&& f, char const* = nullptr) noexcept { - return PIKA_FORWARD(F, f); + return std::forward(f); } template constexpr F&& annotated_function(F&& f, std::string const&) noexcept { - return PIKA_FORWARD(F, f); + return std::forward(f); } #endif } // namespace pika diff --git a/libs/pika/threading_base/include/pika/threading_base/register_thread.hpp b/libs/pika/threading_base/include/pika/threading_base/register_thread.hpp index ef66656f3..d8c58e75e 100644 --- a/libs/pika/threading_base/include/pika/threading_base/register_thread.hpp +++ b/libs/pika/threading_base/include/pika/threading_base/register_thread.hpp @@ -90,13 +90,13 @@ namespace pika::threads::detail { template thread_function_type make_thread_function(F&& f) { - return {thread_function>{PIKA_FORWARD(F, f)}}; + return {thread_function>{std::forward(f)}}; } template thread_function_type make_thread_function_nullary(F&& f) { - return {thread_function_nullary>{PIKA_FORWARD(F, f)}}; + return {thread_function_nullary>{std::forward(f)}}; } /////////////////////////////////////////////////////////////////////////// diff --git a/libs/pika/threading_base/include/pika/threading_base/thread_init_data.hpp b/libs/pika/threading_base/include/pika/threading_base/thread_init_data.hpp index d4aad8c02..8bb54783d 100644 --- a/libs/pika/threading_base/include/pika/threading_base/thread_init_data.hpp +++ b/libs/pika/threading_base/include/pika/threading_base/thread_init_data.hpp @@ -108,7 +108,7 @@ namespace pika::threads::detail { thread_schedule_state initial_state_ = thread_schedule_state::pending, bool run_now_ = false, ::pika::threads::detail::scheduler_base* scheduler_base_ = nullptr) - : func(PIKA_FORWARD(F, f)) + : func(std::forward(f)) #if defined(PIKA_HAVE_THREAD_DESCRIPTION) , description(desc) #endif diff --git a/libs/pika/type_support/include/pika/type_support/detail/with_result_of.hpp b/libs/pika/type_support/include/pika/type_support/detail/with_result_of.hpp index 72298755e..d9c665d51 100644 --- a/libs/pika/type_support/include/pika/type_support/detail/with_result_of.hpp +++ b/libs/pika/type_support/include/pika/type_support/detail/with_result_of.hpp @@ -6,8 +6,6 @@ #pragma once -#include - #include namespace pika::detail { @@ -29,16 +27,16 @@ namespace pika::detail { using type = decltype(std::declval()()); explicit with_result_of_t(F&& f) - : f(PIKA_FORWARD(F, f)) + : f(std::forward(f)) { } - operator type() { return PIKA_FORWARD(F, f)(); } + operator type() { return std::forward(f)(); } }; template inline with_result_of_t with_result_of(F&& f) { - return with_result_of_t(PIKA_FORWARD(F, f)); + return with_result_of_t(std::forward(f)); } } // namespace pika::detail