geomc 1.0
A c++ linear algebra template library
Public Member Functions | Public Attributes | List of all members
UniqueStorage< T, N > Struct Template Reference

Array storage with templated static or dynamic size, and without reference counting. More...

#include <geomc/Storage.h>

Inheritance diagram for UniqueStorage< T, N >:
GenericStorage< T, N, STORAGE_UNIQUE >

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 ith element in the array.
 
operator[] (index_t i) const
 Return the ith element in the array.
 

Public Attributes

data [N]
 Data array.
 

Detailed Description

template<typename T, index_t N>
struct geom::UniqueStorage< T, N >

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 UniqueStorages will also allocate their underlying arrays on the stack.

Template Parameters
TElement type.
NSize of the array, or 0 for dynamic size.

#include <geomc/Storage.h>


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