Skip to content

Commit

Permalink
Avoid unnecessary invoke_result uses in tag_fallback/override_invoke.hpp
Browse files Browse the repository at this point in the history
  • Loading branch information
msimberg committed Mar 13, 2024
1 parent 797f072 commit b963fe0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ namespace pika::functional::detail {

# include <pika/config.hpp>
# include <pika/functional/tag_invoke.hpp>
# include <pika/type_support/type_identity.hpp>

# include <type_traits>
# include <utility>
Expand Down Expand Up @@ -196,11 +197,12 @@ namespace pika::functional::detail {
is_nothrow_tag_fallback_invocable<Tag, Args...>::value;

template <typename Tag, typename... Args>
using tag_fallback_invoke_result =
std::invoke_result<decltype(tag_fallback_invoke_ns::tag_fallback_invoke), Tag, Args...>;
using tag_fallback_invoke_result_t = decltype(tag_fallback_invoke_ns::tag_fallback_invoke(
std::declval<Tag>(), std::declval<Args>()...));

template <typename Tag, typename... Args>
using tag_fallback_invoke_result_t = typename tag_fallback_invoke_result<Tag, Args...>::type;
using tag_fallback_invoke_result =
pika::detail::type_identity<tag_fallback_invoke_result_t<Tag, Args...>>;

///////////////////////////////////////////////////////////////////////////////
namespace tag_base_ns {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ namespace pika::functional::detail {
# include <pika/config.hpp>
# include <pika/functional/detail/tag_fallback_invoke.hpp>
# include <pika/functional/tag_invoke.hpp>
# include <pika/type_support/type_identity.hpp>

# include <type_traits>
# include <utility>
Expand Down Expand Up @@ -199,11 +200,12 @@ namespace pika::functional::detail {
is_nothrow_tag_override_invocable<Tag, Args...>::value;

template <typename Tag, typename... Args>
using tag_override_invoke_result =
std::invoke_result<decltype(tag_override_invoke_ns::tag_override_invoke), Tag, Args...>;
using tag_override_invoke_result_t = decltype(tag_override_invoke_ns::tag_override_invoke(
std::declval<Tag>(), std::declval<Args>()...));

template <typename Tag, typename... Args>
using tag_override_invoke_result_t = typename tag_override_invoke_result<Tag, Args...>::type;
using tag_override_invoke_result =
pika::detail::type_identity<tag_override_invoke_result_t<Tag, Args...>>;

namespace tag_base_ns {
// poison pill
Expand Down

0 comments on commit b963fe0

Please sign in to comment.