22template<
typename ValueType>
23class View :
public std::span<ValueType>
27 using base = std::span<ValueType>;
40 using std::span<ValueType>::span;
44 KOKKOS_INLINE_FUNCTION
45 View(std::span<ValueType> in) :
View(in.begin(), in.end()) {}
50 if (index >= this->
size())
57 Kokkos::abort(
"Index is out of range");
67 return std::span<ValueType>::operator[](
static_cast<size_t>(index));
71 return std::span<ValueType>::operator[](
static_cast<size_t>(index));
74 KOKKOS_INLINE_FUNCTION
77 KOKKOS_INLINE_FUNCTION
80 return base::subspan(
static_cast<size_t>(start),
static_cast<size_t>(length));
83 KOKKOS_INLINE_FUNCTION
86 return base::subspan(
static_cast<size_t>(start));
96 requires(Type& inst) { inst.view(); } ||
requires(
const Type& inst) { inst.view(); };
103template<
typename... Types>
104 requires(hasView<std::remove_reference_t<Types>> && ...)
107 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.