Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to using invoke_result_t #939

Merged
merged 1 commit into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions src/ArborX_LinearBVH.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,13 @@ namespace Details
struct HappyTreeFriends;
} // namespace Details

template <
typename MemorySpace, typename Value,
typename IndexableGetter = Details::DefaultIndexableGetter,
typename BoundingVolume = ExperimentalHyperGeometry::Box<
GeometryTraits::dimension_v<std::decay_t<
decltype(std::declval<IndexableGetter>()(std::declval<Value>()))>>,
typename GeometryTraits::coordinate_type<
std::decay_t<decltype(std::declval<IndexableGetter>()(
std::declval<Value>()))>>::type>>
template <typename MemorySpace, typename Value,
typename IndexableGetter = Details::DefaultIndexableGetter,
typename BoundingVolume = ExperimentalHyperGeometry::Box<
GeometryTraits::dimension_v<
std::decay_t<std::invoke_result_t<IndexableGetter, Value>>>,
typename GeometryTraits::coordinate_type<std::decay_t<
std::invoke_result_t<IndexableGetter, Value>>>::type>>
class BasicBoundingVolumeHierarchy
{
public:
Expand Down Expand Up @@ -106,8 +104,8 @@ class BasicBoundingVolumeHierarchy
private:
friend struct Details::HappyTreeFriends;

using indexable_type = std::decay_t<decltype(std::declval<IndexableGetter>()(
std::declval<Value>()))>;
using indexable_type =
std::decay_t<std::invoke_result_t<IndexableGetter, Value>>;
using leaf_node_type = Details::LeafNode<value_type>;
using internal_node_type = Details::InternalNode<bounding_volume_type>;

Expand Down
12 changes: 4 additions & 8 deletions src/details/ArborX_Callbacks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <Kokkos_DetectionIdiom.hpp>
#include <Kokkos_Macros.hpp>

#include <utility> // declval
#include <type_traits>

namespace ArborX
{
Expand Down Expand Up @@ -50,15 +50,12 @@ struct DefaultCallback
// archetypal expression for user callbacks
template <typename Callback, typename Predicate, typename Out>
using InlineCallbackArchetypeExpression =
decltype(std::declval<Callback const &>()(std::declval<Predicate const &>(),
0, std::declval<Out const &>()));
std::invoke_result_t<Callback, Predicate, int, Out>;

// legacy nearest predicate archetypal expression for user callbacks
template <typename Callback, typename Predicate, typename Out>
using Legacy_NearestPredicateInlineCallbackArchetypeExpression =
decltype(std::declval<Callback const &>()(std::declval<Predicate const &>(),
0, 0.f,
std::declval<Out const &>()));
std::invoke_result_t<Callback, Predicate, int, float, Out>;

// archetypal alias for a 'tag' type member in user callbacks
template <typename Callback>
Expand Down Expand Up @@ -125,8 +122,7 @@ Sorry!)error");
// EXPERIMENTAL archetypal expression for user callbacks
template <typename Callback, typename Predicate, typename Primitive>
using Experimental_CallbackArchetypeExpression =
decltype(std::declval<Callback const &>()(
std::declval<Predicate const &>(), std::declval<Primitive const &>()));
std::invoke_result_t<Callback, Predicate, Primitive>;

// Determine whether the callback returns a hint to exit the tree traversal
// early.
Expand Down
1 change: 0 additions & 1 deletion src/details/ArborX_DetailsHappyTreeFriends.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include <Kokkos_Macros.hpp>

#include <type_traits>
#include <utility> // declval

namespace ArborX::Details
{
Expand Down
3 changes: 1 addition & 2 deletions src/details/ArborX_SpaceFillingCurves.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ namespace Details

template <class SpaceFillingCurve, class Box, class Geometry>
using SpaceFillingCurveProjectionArchetypeExpression =
decltype(std::declval<SpaceFillingCurve const &>()(
std::declval<Box const &>(), std::declval<Geometry const &>()));
std::invoke_result_t<SpaceFillingCurve, Box, Geometry>;

template <int DIM, class SpaceFillingCurve>
void check_valid_space_filling_curve(SpaceFillingCurve const &)
Expand Down