7#include <Kokkos_Core.hpp>
26template<
typename ValueType>
27class View :
public std::span<ValueType>
31 using base = std::span<ValueType>;
44 using std::span<ValueType>::span;
48 KOKKOS_INLINE_FUNCTION
49 View(std::span<ValueType> in) :
View(in.begin(), in.end()) {}
54 if (index < 0 || this->
size() <= index)
62 Kokkos::abort(
"Index is out of range");
72 return std::span<ValueType>::operator[](
static_cast<size_t>(index));
76 return std::span<ValueType>::operator[](
static_cast<size_t>(index));
79 KOKKOS_INLINE_FUNCTION
82 KOKKOS_INLINE_FUNCTION
85 return base::subspan(
static_cast<size_t>(start),
static_cast<size_t>(length));
88 KOKKOS_INLINE_FUNCTION
91 return base::subspan(
static_cast<size_t>(start));
101 requires(Type& inst) { inst.view(); } ||
requires(
const Type& inst) { inst.view(); };
108template<
typename... Types>
109 requires(hasView<std::remove_reference_t<Types>> && ...)
112 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.