Skip to content

Commit

Permalink
Replace pika::util::detail::invoke_result by std::invoke_result
Browse files Browse the repository at this point in the history
  • Loading branch information
aurianer committed Feb 15, 2023
1 parent 5d8ac20 commit 42c8797
Show file tree
Hide file tree
Showing 42 changed files with 87 additions and 189 deletions.
5 changes: 2 additions & 3 deletions libs/pika/async_cuda/include/pika/async_cuda/then_on_host.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ namespace pika::cuda::experimental {
pika::execution::experimental::completion_signatures<
pika::execution::experimental::detail::
result_type_signature_helper_t<
pika::util::detail::invoke_result_t<F, Ts...>>>;
std::invoke_result_t<F, Ts...>>>;

using completion_signatures =
pika::execution::experimental::make_completion_signatures<
Expand All @@ -181,8 +181,7 @@ namespace pika::cuda::experimental {
template <template <typename...> class Tuple, typename... Ts>
struct invoke_result_helper<Tuple<Ts...>>
{
using result_type =
typename pika::util::detail::invoke_result<F, Ts...>::type;
using result_type = std::invoke_result_t<F, Ts...>;
using type =
typename std::conditional<std::is_void<result_type>::value,
Tuple<>, Tuple<result_type>>::type;
Expand Down
17 changes: 7 additions & 10 deletions libs/pika/async_cuda/include/pika/async_cuda/then_with_stream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@ namespace pika::cuda::experimental::then_with_stream_detail {
pika::execution::experimental::completion_signatures<
pika::execution::experimental::detail::
result_type_signature_helper_t<
pika::util::detail::invoke_result_t<F,
cuda_stream const&,
std::invoke_result_t<F, cuda_stream const&,
std::add_lvalue_reference_t<std::decay_t<Ts>>...>>>;

using completion_signatures =
Expand All @@ -198,9 +197,8 @@ namespace pika::cuda::experimental::then_with_stream_detail {
template <template <typename...> class Tuple, typename... Ts>
struct invoke_result_helper<Tuple<Ts...>>
{
using result_type =
pika::util::detail::invoke_result_t<F, cuda_stream const&,
std::add_lvalue_reference_t<std::decay_t<Ts>>...>;
using result_type = std::invoke_result_t<F, cuda_stream const&,
std::add_lvalue_reference_t<std::decay_t<Ts>>...>;
using type = std::conditional_t<std::is_void_v<result_type>,
Tuple<>, Tuple<result_type>>;
};
Expand Down Expand Up @@ -328,11 +326,10 @@ namespace pika::cuda::experimental::then_with_stream_detail {
}
}

using invoke_result_type =
std::decay_t<pika::util::detail::
invoke_result_t<F, cuda_stream const&,
std::add_lvalue_reference_t<
std::decay_t<Ts>>...>>;
using invoke_result_type = std::decay_t<
std::invoke_result_t<F, cuda_stream const&,
std::add_lvalue_reference_t<
std::decay_t<Ts>>...>>;
constexpr bool is_void_result =
std::is_void_v<invoke_result_type>;
if constexpr (is_void_result)
Expand Down
6 changes: 2 additions & 4 deletions libs/pika/async_mpi/include/pika/async_mpi/transform_mpi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,8 @@ namespace pika::mpi::experimental {
std::add_lvalue_reference_t<std::decay_t<Ts>>..., MPI_Request*>;

template <typename F, typename... Ts>
using mpi_request_invoke_result_t =
std::decay_t<pika::util::detail::invoke_result_t<F,
std::add_lvalue_reference_t<std::decay_t<Ts>>...,
MPI_Request*>>;
using mpi_request_invoke_result_t = std::decay_t<std::invoke_result_t<F,
std::add_lvalue_reference_t<std::decay_t<Ts>>..., MPI_Request*>>;

template <typename Sender, typename F>
struct transform_mpi_sender_impl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <pika/execution_base/receiver.hpp>
#include <pika/execution_base/sender.hpp>
#include <pika/functional/detail/tag_priority_invoke.hpp>
#include <pika/functional/invoke_result.hpp>
#include <pika/iterator_support/counting_shape.hpp>
#include <pika/type_support/pack.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <pika/execution_base/sender.hpp>
#include <pika/functional/detail/tag_fallback_invoke.hpp>
#include <pika/functional/invoke_fused.hpp>
#include <pika/functional/invoke_result.hpp>
#include <pika/type_support/detail/with_result_of.hpp>
#include <pika/type_support/pack.hpp>

Expand Down Expand Up @@ -68,8 +67,8 @@ namespace pika::let_error_detail {
template <typename Error>
struct successor_sender_types_helper
{
using type = pika::util::detail::invoke_result_t<F,
std::add_lvalue_reference_t<Error>>;
using type =
std::invoke_result_t<F, std::add_lvalue_reference_t<Error>>;
static_assert(pika::execution::experimental::is_sender<
std::decay_t<type>>::value,
"let_error expects the invocable sender factory to return "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <pika/execution_base/sender.hpp>
#include <pika/functional/detail/tag_fallback_invoke.hpp>
#include <pika/functional/invoke_fused.hpp>
#include <pika/functional/invoke_result.hpp>
#include <pika/type_support/detail/with_result_of.hpp>
#include <pika/type_support/pack.hpp>

Expand Down Expand Up @@ -67,8 +66,8 @@ namespace pika::let_value_detail {
template <template <typename...> class Tuple, typename... Ts>
struct successor_sender_types_helper<Tuple<Ts...>>
{
using type = pika::util::detail::invoke_result_t<F,
std::add_lvalue_reference_t<Ts>...>;
using type =
std::invoke_result_t<F, std::add_lvalue_reference_t<Ts>...>;
static_assert(pika::execution::experimental::is_sender<
std::decay_t<type>>::value,
"let_value expects the invocable sender factory to return "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <pika/execution/algorithms/detail/partial_algorithm.hpp>
#include <pika/execution_base/operation_state.hpp>
#include <pika/execution_base/sender.hpp>
#include <pika/functional/invoke_result.hpp>
#include <pika/futures/detail/future_data.hpp>
#include <pika/futures/promise.hpp>
#include <pika/memory/intrusive_ptr.hpp>
Expand All @@ -31,6 +30,7 @@
#include <exception>
#include <memory>
#include <optional>
#include <type_traits>
#include <utility>

namespace pika::make_future_detail {
Expand Down Expand Up @@ -214,9 +214,9 @@ namespace pika::make_future_detail {
using result_type =
std::decay_t<pika::execution::experimental::detail::single_result_t<
value_types>>;
using operation_state_type = pika::util::detail::invoke_result_t<
pika::execution::experimental::connect_t, Sender,
make_future_receiver<result_type, allocator_type>>;
using operation_state_type =
std::invoke_result_t<pika::execution::experimental::connect_t,
Sender, make_future_receiver<result_type, allocator_type>>;

using shared_state =
future_data<result_type, allocator_type, operation_state_type>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ namespace pika::schedule_from_detail {
Sender>::template error_types<Variant>;

using scheduler_sender_type =
typename pika::util::detail::invoke_result<
pika::execution::experimental::schedule_t, Scheduler>::type;
std::invoke_result_t<pika::execution::experimental::schedule_t,
Scheduler>;
template <template <typename...> class Variant>
using scheduler_sender_error_types =
typename pika::execution::experimental::sender_traits<
Expand Down Expand Up @@ -139,9 +139,8 @@ namespace pika::schedule_from_detail {

using scheduler_operation_state_type =
pika::execution::experimental::connect_result_t<
typename pika::util::detail::invoke_result<
pika::execution::experimental::schedule_t,
Scheduler>::type,
std::invoke_result_t<
pika::execution::experimental::schedule_t, Scheduler>,
scheduler_sender_receiver>;
std::optional<scheduler_operation_state_type> scheduler_op_state;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <pika/execution_base/operation_state.hpp>
#include <pika/execution_base/sender.hpp>
#include <pika/functional/detail/tag_fallback_invoke.hpp>
#include <pika/functional/invoke_result.hpp>
#include <pika/memory/intrusive_ptr.hpp>
#include <pika/thread_support/atomic_count.hpp>
#include <pika/type_support/unused.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <pika/execution_base/completion_scheduler.hpp>
#include <pika/execution_base/receiver.hpp>
#include <pika/execution_base/sender.hpp>
#include <pika/functional/detail/invoke.hpp>
#include <pika/functional/detail/tag_fallback_invoke.hpp>
#include <pika/type_support/pack.hpp>

Expand Down Expand Up @@ -61,8 +62,8 @@ namespace pika::then_detail {
{
pika::detail::try_catch_exception_ptr(
[&]() {
if constexpr (std::is_void_v<pika::util::detail::
invoke_result_t<F, Ts...>>)
if constexpr (std::is_void_v<
std::invoke_result_t<F, Ts...>>)
{
// Certain versions of GCC with optimizations fail on
// the move with an internal compiler error.
Expand Down Expand Up @@ -126,7 +127,7 @@ namespace pika::then_detail {
template <template <typename...> class Tuple, typename... Ts>
struct invoke_result_helper<Tuple<Ts...>>
{
using result_type = pika::util::detail::invoke_result_t<F, Ts...>;
using result_type = std::invoke_result_t<F, Ts...>;
using type = std::conditional_t<std::is_void<result_type>::value,
Tuple<>, Tuple<result_type>>;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include <pika/execution/traits/future_then_result_exec.hpp>
#include <pika/execution_base/traits/is_executor.hpp>
#include <pika/functional/invoke.hpp>
#include <pika/functional/invoke_result.hpp>
#include <pika/futures/detail/future_data.hpp>
#include <pika/futures/future.hpp>
#include <pika/futures/packaged_continuation.hpp>
Expand Down Expand Up @@ -57,8 +56,7 @@ namespace pika::lcos::detail {
using result_type =
typename pika::traits::future_then_result<Future,
F>::result_type;
using continuation_result_type =
pika::util::detail::invoke_result_t<F, Future>;
using continuation_result_type = std::invoke_result_t<F, Future>;

pika::traits::detail::shared_state_ptr_t<result_type> p =
detail::make_continuation_alloc<continuation_result_type>(
Expand All @@ -77,8 +75,7 @@ namespace pika::lcos::detail {
using result_type =
typename pika::traits::future_then_result<Future,
F>::result_type;
using continuation_result_type =
pika::util::detail::invoke_result_t<F, Future>;
using continuation_result_type = std::invoke_result_t<F, Future>;

pika::traits::detail::shared_state_ptr_t<result_type> p =
detail::make_continuation_alloc<continuation_result_type>(alloc,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <pika/functional/bind_back.hpp>
#include <pika/functional/deferred_call.hpp>
#include <pika/functional/detail/invoke.hpp>
#include <pika/functional/invoke_result.hpp>
#include <pika/futures/future.hpp>
#include <pika/futures/traits/future_access.hpp>
#include <pika/futures/traits/future_traits.hpp>
Expand Down Expand Up @@ -282,7 +281,7 @@ namespace pika::parallel::execution::detail {
// fall-back: emulate sync_execute using async_execute
template <typename TwoWayExecutor, typename F, typename... Ts>
static auto call_impl(std::false_type, TwoWayExecutor&& exec, F&& f,
Ts&&... ts) -> pika::util::detail::invoke_result_t<F, Ts...>
Ts&&... ts) -> std::invoke_result_t<F, Ts...>
{
try
{
Expand Down Expand Up @@ -321,7 +320,7 @@ namespace pika::parallel::execution::detail {
template <typename TwoWayExecutor, typename F, typename... Ts>
PIKA_FORCEINLINE static auto call_impl(
pika::detail::wrap_int, TwoWayExecutor&& exec, F&& f, Ts&&... ts)
-> pika::util::detail::invoke_result_t<F, Ts...>
-> std::invoke_result_t<F, Ts...>
{
using is_void = typename std::is_void<
pika::util::detail::invoke_deferred_result_t<F, Ts...>>::type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <pika/config.hpp>
#include <pika/execution/traits/executor_traits.hpp>
#include <pika/execution_base/traits/is_executor.hpp>
#include <pika/functional/invoke_result.hpp>
#include <pika/futures/traits/future_then_result.hpp>
#include <pika/futures/traits/future_traits.hpp>
#include <pika/futures/traits/is_future.hpp>
Expand All @@ -33,10 +32,9 @@ namespace pika::traits {

template <typename Executor, typename Future, typename F>
struct future_then_executor_result<Executor, Future, F,
std::void_t<pika::util::detail::invoke_result_t<F&, Future>>>
std::void_t<std::invoke_result_t<F&, Future>>>
{
using func_result_type =
pika::util::detail::invoke_result_t<F&, Future>;
using func_result_type = std::invoke_result_t<F&, Future>;

using cont_result =
traits::executor_future_t<Executor, func_result_type, Future>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ struct test_async_executor
using execution_category = pika::execution::parallel_execution_tag;

template <typename F, typename... Ts>
static pika::future<
typename pika::util::detail::invoke_result<F, Ts...>::type>
static pika::future<std::invoke_result_t<F, Ts...>>
async_execute(F&& f, Ts&&... ts)
{
return pika::dataflow(
Expand Down
3 changes: 1 addition & 2 deletions libs/pika/execution/tests/unit/minimal_async_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ struct test_async_executor1
using execution_category = pika::execution::parallel_execution_tag;

template <typename F, typename... Ts>
static pika::future<
typename pika::util::detail::invoke_result<F, Ts...>::type>
static pika::future<std::invoke_result_t<F, Ts...>>
async_execute(F&& f, Ts&&... ts)
{
++count_async;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ namespace pika::execution::experimental {
#include <pika/config/constexpr.hpp>
#include <pika/execution_base/operation_state.hpp>
#include <pika/execution_base/receiver.hpp>
#include <pika/functional/invoke_result.hpp>
#include <pika/functional/tag_invoke.hpp>
#include <pika/type_support/equality.hpp>

Expand Down Expand Up @@ -236,7 +235,7 @@ namespace pika::execution::experimental {
template <typename S, typename R>
struct connect_result_helper<S, R,
std::enable_if_t<std::is_invocable<connect_t, S, R>::value>>
: pika::util::detail::invoke_result<connect_t, S, R>
: std::invoke_result<connect_t, S, R>
{
};
} // namespace detail
Expand Down Expand Up @@ -465,8 +464,7 @@ namespace pika::execution::experimental {
inline constexpr bool is_scheduler_v = is_scheduler<Scheduler>::value;

template <typename S, typename R>
using connect_result_t =
typename pika::util::detail::invoke_result<connect_t, S, R>::type;
using connect_result_t = std::invoke_result_t<connect_t, S, R>;
} // namespace pika::execution::experimental
#endif

Expand Down
3 changes: 1 addition & 2 deletions libs/pika/executors/tests/unit/shared_parallel_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
struct shared_parallel_executor
{
template <typename F, typename... Ts>
pika::shared_future<
typename pika::util::detail::invoke_result<F, Ts...>::type>
pika::shared_future<std::invoke_result_t<F, Ts...>>
async_execute(F&& f, Ts&&... ts)
{
return pika::async(std::forward<F>(f), std::forward<Ts>(ts)...);
Expand Down
8 changes: 3 additions & 5 deletions libs/pika/functional/include/pika/functional/bind.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <pika/assert.hpp>
#include <pika/datastructures/member_pack.hpp>
#include <pika/functional/invoke.hpp>
#include <pika/functional/invoke_result.hpp>
#include <pika/functional/one_shot.hpp>
#include <pika/functional/traits/get_function_address.hpp>
#include <pika/functional/traits/get_function_annotation.hpp>
Expand Down Expand Up @@ -62,9 +61,8 @@ namespace pika::util::detail {
{
PIKA_NVCC_PRAGMA_HD_WARNING_DISABLE
template <typename... Us>
static constexpr PIKA_HOST_DEVICE
util::detail::invoke_result_t<T, Us...>
call(T&& t, Us&&... vs)
static constexpr PIKA_HOST_DEVICE std::invoke_result_t<T, Us...>
call(T&& t, Us&&... vs)
{
return PIKA_INVOKE(PIKA_FORWARD(T, t), PIKA_FORWARD(Us, vs)...);
}
Expand All @@ -76,7 +74,7 @@ namespace pika::util::detail {

template <typename F, typename... Ts, typename... Us>
struct invoke_bound_result<F, util::detail::pack<Ts...>, Us...>
: util::detail::invoke_result<F,
: std::invoke_result<F,
decltype(bind_eval<Ts, sizeof...(Us)>::call(
std::declval<Ts>(), std::declval<Us>()...))...>
{
Expand Down
3 changes: 1 addition & 2 deletions libs/pika/functional/include/pika/functional/bind_back.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <pika/config.hpp>
#include <pika/datastructures/member_pack.hpp>
#include <pika/functional/invoke.hpp>
#include <pika/functional/invoke_result.hpp>
#include <pika/functional/one_shot.hpp>
#include <pika/functional/traits/get_function_address.hpp>
#include <pika/functional/traits/get_function_annotation.hpp>
Expand All @@ -27,7 +26,7 @@ namespace pika::util::detail {

template <typename F, typename... Ts, typename... Us>
struct invoke_bound_back_result<F, util::detail::pack<Ts...>, Us...>
: util::detail::invoke_result<F, Us..., Ts...>
: std::invoke_result<F, Us..., Ts...>
{
};

Expand Down
3 changes: 1 addition & 2 deletions libs/pika/functional/include/pika/functional/bind_front.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <pika/config.hpp>
#include <pika/datastructures/member_pack.hpp>
#include <pika/functional/invoke.hpp>
#include <pika/functional/invoke_result.hpp>
#include <pika/functional/one_shot.hpp>
#include <pika/functional/traits/get_function_address.hpp>
#include <pika/functional/traits/get_function_annotation.hpp>
Expand All @@ -27,7 +26,7 @@ namespace pika::util::detail {

template <typename F, typename... Ts, typename... Us>
struct invoke_bound_front_result<F, util::detail::pack<Ts...>, Us...>
: util::detail::invoke_result<F, Ts..., Us...>
: std::invoke_result<F, Ts..., Us...>
{
};

Expand Down
Loading

0 comments on commit 42c8797

Please sign in to comment.