SyTen
syten::Cuda::CudaConstSpan< T > Class Template Reference

CudaConstSpan is a non-owning constant reference to a continuous array of objects in CUDA storage. More...

#include <cuda_span.h>

+ Collaboration diagram for syten::Cuda::CudaConstSpan< T >:

Public Member Functions

CudaPtr< const T > begin () const
 Returns a pointer-to-const to the beginning of the region. More...
 
 CudaConstSpan ()=default
 Default ctor, initialises an empty region. More...
 
 CudaConstSpan (CudaConstSpan< T > const &)=default
 Copy ctor. More...
 
 CudaConstSpan (CudaDynArray< T > const &c)
 Standard ctor. More...
 
 CudaConstSpan (CudaMutSpan< T > c)
 Alternative ctor from an existing MutSpan which provides a constant view on the same range as the MutSpan. More...
 
 CudaConstSpan (CudaPtr< const T > ptr_, std::size_t len)
 Alternative ctor, takes a pointer and a length. More...
 
CudaPtr< const T > end () const
 Returns a pointer-to-const to one past the end of the region. More...
 
get_value (std::size_t idx) const
 Returns an element by-value. More...
 
std::size_t size () const
 Returns the size of the region. More...
 

Private Attributes

CudaPtr< const T > ptr {nullptr}
 Pointer-to-const to the start of the region. More...
 
std::size_t sz {0}
 Number of Ts in the region. More...
 

Detailed Description

template<typename T>
class syten::Cuda::CudaConstSpan< T >

CudaConstSpan is a non-owning constant reference to a continuous array of objects in CUDA storage.

The region from which CudaConstSpan has been initialised needs to live throughout the span's lifetime. It is not possible to extend or shrink the region, nor is it possible to mutate the elements in the region.

CudaConstSpans can be created either using a constant reference to a suitable container with a value_type member typedef or a plain pointer/size pair.

Remarks
Functionally, this is quite similar to a pair of constant random access iterators ‘begin’ and ‘end’.
Template Parameters
Tthe type of the objects in the region of memory.

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