geomc 1.0
A c++ linear algebra template library
|
Array storage with templated static or dynamic size, and without reference counting. More...
#include <geomc/Storage.h>
Public Member Functions | |
UniqueStorage () | |
Construct a new UniqueStorage of size N . (Static size only). | |
UniqueStorage (index_t n) | |
Construct a new UniqueStorage of size n . n is ignored if the array size is not dynamic. | |
UniqueStorage (index_t n, const T *srcdata) | |
Construct a new UniqueStorage of size n , and copy n elements from srcdata into the new array. | |
T * | get () |
Return a pointer to the first element in the storage array. | |
const T * | get () const |
Return a pointer to the first (const) element in the storage array. | |
index_t | size () const |
Return the number of elements in the array. | |
T & | operator[] (index_t i) |
Return a reference to the i th element in the array. | |
T | operator[] (index_t i) const |
Return the i th element in the array. | |
Public Attributes | |
T | data [N] |
Data array. | |
Array storage with templated static or dynamic size, and without reference counting.
Copy constructions and assignments of will result in a duplication of the underlying array. (If c++11 support is enabled, then move assignments and constructions of dynamically-sized arrays will be lightweight).
Statically-sized instances use local member arrays (as opposed to heap-allocated ones), so stack-allocated UniqueStorage
s will also allocate their underlying arrays on the stack.
T | Element type. |
N | Size of the array, or 0 for dynamic size. |
#include <geomc/Storage.h>