RAJA
RAJA provides a collection of platform portability abstractions for C++ HPC applications.
Public Types | Public Member Functions | Friends | List of all members
RAJA::Span< IterType, IndexType > Struct Template Reference

A view to a sequence of objects. More...

#include <Span.hpp>

Public Types

using element_type = typename std::iterator_traits< IterType >::value_type
 
using value_type = camp::decay< element_type >
 
using size_type = IndexType
 
using difference_type = std::ptrdiff_t
 
using reference = element_type &
 
using const_reference = const element_type &
 
using iterator = IterType
 
using const_iterator = IterType
 

Public Member Functions

constexpr RAJA_HOST_DEVICE Span (iterator begin, iterator end)
 
constexpr RAJA_HOST_DEVICE Span (iterator begin, size_type size)
 
constexpr RAJA_HOST_DEVICE RAJA_INLINE iterator begin ()
 
constexpr RAJA_HOST_DEVICE RAJA_INLINE iterator end ()
 
constexpr RAJA_HOST_DEVICE RAJA_INLINE const_iterator begin () const
 
constexpr RAJA_HOST_DEVICE RAJA_INLINE const_iterator end () const
 
constexpr RAJA_HOST_DEVICE RAJA_INLINE const_iterator cbegin () const
 
constexpr RAJA_HOST_DEVICE RAJA_INLINE const_iterator cend () const
 
constexpr RAJA_HOST_DEVICE RAJA_INLINE reference front () const
 
constexpr RAJA_HOST_DEVICE RAJA_INLINE reference back () const
 
constexpr RAJA_HOST_DEVICE RAJA_INLINE reference operator[] (size_type i) const
 
constexpr RAJA_HOST_DEVICE RAJA_INLINE iterator data () const
 
constexpr RAJA_HOST_DEVICE RAJA_INLINE size_type size () const
 
constexpr RAJA_HOST_DEVICE RAJA_INLINE bool empty () const
 
constexpr RAJA_HOST_DEVICE RAJA_INLINE Span first (size_type count) const
 
constexpr RAJA_HOST_DEVICE RAJA_INLINE Span last (size_type count) const
 
constexpr RAJA_HOST_DEVICE RAJA_INLINE Span subspan (size_type begin, size_type length) const
 
constexpr RAJA_HOST_DEVICE RAJA_INLINE Span slice (size_type begin, size_type length) const
 

Friends

constexpr RAJA_HOST_DEVICE RAJA_INLINE friend iterator begin (Span &s)
 
constexpr RAJA_HOST_DEVICE RAJA_INLINE friend iterator end (Span &s)
 
constexpr RAJA_HOST_DEVICE RAJA_INLINE friend const_iterator begin (const Span &s)
 
constexpr RAJA_HOST_DEVICE RAJA_INLINE friend const_iterator end (const Span &s)
 
constexpr RAJA_HOST_DEVICE RAJA_INLINE friend const_iterator cbegin (const Span &s)
 
constexpr RAJA_HOST_DEVICE RAJA_INLINE friend const_iterator cend (const Span &s)
 

Detailed Description

template<typename IterType, typename IndexType>
struct RAJA::Span< IterType, IndexType >

A view to a sequence of objects.

Creates a view or container object given a random access iterator and length. Allows use of container interface functions using iterators. Indices are of the type of the second template parameter.

For example:

// Create a span object for an array of ints
Span<int*, int> int_span(int_ptr, int_len);

// Use with RAJA sort
RAJA::sort<policy>(int_span);

// Create a span object another way
auto double_span = make_span(double_ptr, double_len);

// Use with RAJA scan
RAJA::inclusive_scan_inplace<policy>(double_span);

Based on the std::span template. Differs in that it supports: random access instead of contiguous iterators different index types and does not support: compile time extents

Member Typedef Documentation

◆ element_type

template<typename IterType , typename IndexType >
using RAJA::Span< IterType, IndexType >::element_type = typename std::iterator_traits<IterType>::value_type

◆ value_type

template<typename IterType , typename IndexType >
using RAJA::Span< IterType, IndexType >::value_type = camp::decay<element_type>

◆ size_type

template<typename IterType , typename IndexType >
using RAJA::Span< IterType, IndexType >::size_type = IndexType

◆ difference_type

template<typename IterType , typename IndexType >
using RAJA::Span< IterType, IndexType >::difference_type = std::ptrdiff_t

◆ reference

template<typename IterType , typename IndexType >
using RAJA::Span< IterType, IndexType >::reference = element_type&

◆ const_reference

template<typename IterType , typename IndexType >
using RAJA::Span< IterType, IndexType >::const_reference = const element_type&

◆ iterator

template<typename IterType , typename IndexType >
using RAJA::Span< IterType, IndexType >::iterator = IterType

◆ const_iterator

template<typename IterType , typename IndexType >
using RAJA::Span< IterType, IndexType >::const_iterator = IterType

Constructor & Destructor Documentation

◆ Span() [1/2]

template<typename IterType , typename IndexType >
constexpr RAJA_HOST_DEVICE RAJA::Span< IterType, IndexType >::Span ( iterator  begin,
iterator  end 
)
inlineconstexpr

◆ Span() [2/2]

template<typename IterType , typename IndexType >
constexpr RAJA_HOST_DEVICE RAJA::Span< IterType, IndexType >::Span ( iterator  begin,
size_type  size 
)
inlineconstexpr

Member Function Documentation

◆ begin() [1/2]

template<typename IterType , typename IndexType >
constexpr RAJA_HOST_DEVICE RAJA_INLINE iterator RAJA::Span< IterType, IndexType >::begin ( )
inlineconstexpr

◆ end() [1/2]

template<typename IterType , typename IndexType >
constexpr RAJA_HOST_DEVICE RAJA_INLINE iterator RAJA::Span< IterType, IndexType >::end ( )
inlineconstexpr

◆ begin() [2/2]

template<typename IterType , typename IndexType >
constexpr RAJA_HOST_DEVICE RAJA_INLINE const_iterator RAJA::Span< IterType, IndexType >::begin ( ) const
inlineconstexpr

◆ end() [2/2]

template<typename IterType , typename IndexType >
constexpr RAJA_HOST_DEVICE RAJA_INLINE const_iterator RAJA::Span< IterType, IndexType >::end ( ) const
inlineconstexpr

◆ cbegin()

template<typename IterType , typename IndexType >
constexpr RAJA_HOST_DEVICE RAJA_INLINE const_iterator RAJA::Span< IterType, IndexType >::cbegin ( ) const
inlineconstexpr

◆ cend()

template<typename IterType , typename IndexType >
constexpr RAJA_HOST_DEVICE RAJA_INLINE const_iterator RAJA::Span< IterType, IndexType >::cend ( ) const
inlineconstexpr

◆ front()

template<typename IterType , typename IndexType >
constexpr RAJA_HOST_DEVICE RAJA_INLINE reference RAJA::Span< IterType, IndexType >::front ( ) const
inlineconstexpr

◆ back()

template<typename IterType , typename IndexType >
constexpr RAJA_HOST_DEVICE RAJA_INLINE reference RAJA::Span< IterType, IndexType >::back ( ) const
inlineconstexpr

◆ operator[]()

template<typename IterType , typename IndexType >
constexpr RAJA_HOST_DEVICE RAJA_INLINE reference RAJA::Span< IterType, IndexType >::operator[] ( size_type  i) const
inlineconstexpr

◆ data()

template<typename IterType , typename IndexType >
constexpr RAJA_HOST_DEVICE RAJA_INLINE iterator RAJA::Span< IterType, IndexType >::data ( ) const
inlineconstexpr

◆ size()

template<typename IterType , typename IndexType >
constexpr RAJA_HOST_DEVICE RAJA_INLINE size_type RAJA::Span< IterType, IndexType >::size ( ) const
inlineconstexpr

◆ empty()

template<typename IterType , typename IndexType >
constexpr RAJA_HOST_DEVICE RAJA_INLINE bool RAJA::Span< IterType, IndexType >::empty ( ) const
inlineconstexpr

◆ first()

template<typename IterType , typename IndexType >
constexpr RAJA_HOST_DEVICE RAJA_INLINE Span RAJA::Span< IterType, IndexType >::first ( size_type  count) const
inlineconstexpr

◆ last()

template<typename IterType , typename IndexType >
constexpr RAJA_HOST_DEVICE RAJA_INLINE Span RAJA::Span< IterType, IndexType >::last ( size_type  count) const
inlineconstexpr

◆ subspan()

template<typename IterType , typename IndexType >
constexpr RAJA_HOST_DEVICE RAJA_INLINE Span RAJA::Span< IterType, IndexType >::subspan ( size_type  begin,
size_type  length 
) const
inlineconstexpr

◆ slice()

template<typename IterType , typename IndexType >
constexpr RAJA_HOST_DEVICE RAJA_INLINE Span RAJA::Span< IterType, IndexType >::slice ( size_type  begin,
size_type  length 
) const
inlineconstexpr

Friends And Related Function Documentation

◆ begin [1/2]

template<typename IterType , typename IndexType >
constexpr RAJA_HOST_DEVICE RAJA_INLINE friend iterator begin ( Span< IterType, IndexType > &  s)
friend

◆ end [1/2]

template<typename IterType , typename IndexType >
constexpr RAJA_HOST_DEVICE RAJA_INLINE friend iterator end ( Span< IterType, IndexType > &  s)
friend

◆ begin [2/2]

template<typename IterType , typename IndexType >
constexpr RAJA_HOST_DEVICE RAJA_INLINE friend const_iterator begin ( const Span< IterType, IndexType > &  s)
friend

◆ end [2/2]

template<typename IterType , typename IndexType >
constexpr RAJA_HOST_DEVICE RAJA_INLINE friend const_iterator end ( const Span< IterType, IndexType > &  s)
friend

◆ cbegin

template<typename IterType , typename IndexType >
constexpr RAJA_HOST_DEVICE RAJA_INLINE friend const_iterator cbegin ( const Span< IterType, IndexType > &  s)
friend

◆ cend

template<typename IterType , typename IndexType >
constexpr RAJA_HOST_DEVICE RAJA_INLINE friend const_iterator cend ( const Span< IterType, IndexType > &  s)
friend

The documentation for this struct was generated from the following file: