5#include <Kokkos_Core.hpp>
24template<
typename ValueType>
25class View :
public std::span<ValueType>
29 using base = std::span<ValueType>;
42 using std::span<ValueType>::span;
46 KOKKOS_INLINE_FUNCTION
47 View(std::span<ValueType> in) :
View(in.begin(), in.end()) {}
52 if (index < 0 || this->
size() <= index)
60 Kokkos::abort(
"Index is out of range");
70 return std::span<ValueType>::operator[](
static_cast<size_t>(index));
74 return std::span<ValueType>::operator[](
static_cast<size_t>(index));
77 KOKKOS_INLINE_FUNCTION
80 KOKKOS_INLINE_FUNCTION
83 return base::subspan(
static_cast<size_t>(start),
static_cast<size_t>(length));
86 KOKKOS_INLINE_FUNCTION
89 return base::subspan(
static_cast<size_t>(start));
99 requires(Type& inst) { inst.view(); } ||
requires(
const Type& inst) { inst.view(); };
106template<
typename... Types>
107 requires(hasView<std::remove_reference_t<Types>> && ...)
110 return std::tuple(args.view()...);
std::span< ValueType > base
KOKKOS_INLINE_FUNCTION View< ValueType > subview(localIdx start, localIdx length) const
constexpr ValueType & operator[](localIdx index) const
KOKKOS_INLINE_FUNCTION View(std::span< ValueType > in)
KOKKOS_INLINE_FUNCTION View< ValueType > subview(localIdx start) const
KOKKOS_INLINE_FUNCTION localIdx size() const
Concept, for any type which has the 'view' method.
auto views(Types &... args)
Unpacks all views of the passed classes.