CudaConstSpan is a non-owning constant reference to a continuous array of objects in CUDA storage. More...
#include <cuda_span.h>
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... | |
T | 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 T s in the region. More... | |
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.
CudaConstSpan
s can be created either using a constant reference to a suitable container with a value_type
member typedef or a plain pointer/size pair.
T | the type of the objects in the region of memory. |