6#include <Kokkos_Core.hpp>
15template <class InputIt, class T = typename std::iterator_traits<InputIt>::value_type>
16KOKKOS_FUNCTION
constexpr InputIt find(InputIt first, InputIt last,
const T& value)
18 for (; first != last; ++first)
54constexpr std::remove_reference_t<T>&& move(T&& t)
noexcept
56 return static_cast<typename std::remove_reference<T>::type&&
>(t);
59template <
class InputIt,
class OutputIt>
60KOKKOS_FUNCTION OutputIt move(InputIt first, InputIt last, OutputIt d_first)
62 for (; first != last; ++d_first, ++first)
63 *d_first = move(*first);
69KOKKOS_FUNCTION
constexpr std::size_t bounded_advance(I& i, std::size_t n, I
const bound)
71 for (; n > 0 && i != bound; --n, void(++i)) {
78template <
class ForwardIt>
79KOKKOS_FUNCTION ForwardIt shift_left(ForwardIt first, ForwardIt last, std::size_t n)
86 if (bounded_advance(mid, n, last)) {
90 return move(move(mid), move(last), move(first));
93template <
class InputIt,
class OutputIt>
94constexpr OutputIt copy(InputIt first, InputIt last, OutputIt d_first)
96 for (; first != last; (void)++first, (void)++d_first)
103template <
typename It,
typename Compare = std::less<>>
104constexpr void sort(It begin, It end, Compare comp = Compare())
106 for (It i = begin; i != end; ++i) {
107 for (It j = begin; j < end - 1; ++j) {
108 if (comp(*(j + 1), *j)) {
109 Kokkos::kokkos_swap(*j, *(j + 1));
The top-level namespace of SimiLie.