CUGL 2.1
Cornell University Game Library
|
#include <CUAligned.h>
Public Member Functions | |
Aligned () | |
Aligned (size_t size, size_t alignment) | |
Aligned (const Aligned< T > ©) | |
Aligned (Aligned< T > &&other) | |
~Aligned () | |
void | dispose () |
bool | reset (size_t size, size_t alignment) |
void | clear () |
size_t | size () const |
Aligned< T > & | operator= (const Aligned< T > ©) |
Aligned< T > & | operator= (Aligned< T > &&other) |
operator T* () const | |
T & | operator* () |
T * | operator+ (size_t offset) |
T & | operator[] (size_t idx) |
const T & | operator[] (size_t idx) const |
Static Public Member Functions | |
static std::shared_ptr< Aligned< T > > | alloc (size_t size, size_t alignment) |
This template provides support for a aligned arrays
Explicit aligned memory allocation is supported in C++17, but not in C++11. As Android can only guarantee C++11, this poses a bit of a problem for Neon and vector optimization. This class presents a workaround that is compatible with C++11.
|
inline |
Creates an empty (nullptr) aligned array.
|
inline |
Creates an aligned array of the given size and alignment.
size | The number of elements in the array |
alignment | The alignment stride |
|
inline |
Creates an (aligned) copy of the given aligned array.
copy | The aligned array to copy |
|
inline |
Acquires ownership of the contents of an aligned array.
other | The aligned array to move |
|
inline |
Deletes the given aligned array, releasing all resources.
|
inlinestatic |
Returns an aligned array of the given size and alignment.
size | The number of elements in the array |
alignment | The alignment stride |
|
inline |
Clears the contents of the given aligned array.
|
inline |
Disposes the resources of given aligned array, making it a null pointer.
|
inline |
Returns a pointer to the first element in the array
|
inline |
Returns a reference to the first element in the array
|
inline |
Returns a pointer to the offset element of the array
offset | The array position to access |
Acquires ownership of the contents of the given aligned array.
other | The aligned array to subsume |
Copies the given aligned array.
copy | The aligned array to copy |
|
inline |
Returns a reference to the offset element of the array
idx | The array position to access |
|
inline |
Returns the value of the offset element of the array
idx | The array position to access |
|
inline |
Resets an aligned array to an empty one of the given size and alignment.
size | The number of elements in the array |
alignment | The alignment stride |
|
inline |
Returns the size of this array.