Skip to content

Commit e828276

Browse files
committed
Just forward to std when not using kokkos
1 parent 896f8ca commit e828276

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

src/utilities/include/metaphysicl/metaphysicl_algorithm.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
33

44
#include "metaphysicl/metaphysicl_device.h"
55

6+
#include <algorithm>
67
#include <type_traits>
78

89
namespace MetaPhysicL::detail {
910

11+
#ifdef METAPHYSICL_KOKKOS_COMPILATION
12+
1013
template <typename T, typename U>
1114
METAPHYSICL_INLINE constexpr bool less(const T & lhs, const U & rhs)
1215
{
@@ -96,6 +99,36 @@ METAPHYSICL_INLINE bool is_sorted(ForwardIt first, ForwardIt last)
9699
return true;
97100
}
98101

102+
#else
103+
104+
template <typename ForwardIt, typename T>
105+
METAPHYSICL_INLINE ForwardIt lower_bound(ForwardIt first, ForwardIt last, const T & value)
106+
{
107+
return std::lower_bound(first, last, value);
108+
}
109+
110+
template <typename BidirectionalIt1, typename BidirectionalIt2>
111+
METAPHYSICL_INLINE BidirectionalIt2 copy_backward(BidirectionalIt1 first,
112+
BidirectionalIt1 last,
113+
BidirectionalIt2 result)
114+
{
115+
return std::copy_backward(first, last, result);
116+
}
117+
118+
template <typename ForwardIt>
119+
METAPHYSICL_INLINE ForwardIt adjacent_find(ForwardIt first, ForwardIt last)
120+
{
121+
return std::adjacent_find(first, last);
122+
}
123+
124+
template <typename ForwardIt>
125+
METAPHYSICL_INLINE bool is_sorted(ForwardIt first, ForwardIt last)
126+
{
127+
return std::is_sorted(first, last);
128+
}
129+
130+
#endif
131+
99132
} // namespace MetaPhysicL::detail
100133

101134
#endif // METAPHYSICL_ALGORITHM_H

0 commit comments

Comments
 (0)