Skip to content

Commit

Permalink
Switch to using invoke_result_t
Browse files Browse the repository at this point in the history
  • Loading branch information
aprokop committed Aug 26, 2023
1 parent 1fcc505 commit 969e5d2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 22 deletions.
20 changes: 9 additions & 11 deletions src/ArborX_LinearBVH.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,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 @@ -94,8 +92,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

0 comments on commit 969e5d2

Please sign in to comment.