A templated class for managing an array of data using a specified memory type.
The Array class provides a convenient interface for managing an array of data using different memory types (e.g., memory on the host or device). The memory is automatically freed at the end of the lifetime.
Data_t | The type of data elements to be stored in the array. |
Memory_t | The type of memory that provides storage for the array. |
Definition at line 169 of file CudaInterface.h.
Public Member Functions | |
Array (std::size_t n) | |
Constructor to create an Array object with a specified size. | |
Data_t * | data () |
Get a pointer to the start of the array. | |
Data_t const * | data () const |
Get a const pointer to the start of the array. | |
std::size_t | size () const |
Get the size of the array. | |
|
inline |
Constructor to create an Array object with a specified size.
n | The size of the array (number of elements). |
Definition at line 175 of file CudaInterface.h.
|
inline |
Get a pointer to the start of the array.
This function returns a pointer to the underlying memory. It allows direct manipulation of array elements.
Definition at line 193 of file CudaInterface.h.
|
inline |
Get a const pointer to the start of the array.
This function returns a const pointer to the underlying memory. It allows read-only access to array elements.
Definition at line 202 of file CudaInterface.h.
|
inline |
Get the size of the array.
This function returns the number of elements in the array.
Definition at line 184 of file CudaInterface.h.