#include <UninitializedVector.h>
Public Member Functions | |
UninitializedVector () | |
~UninitializedVector () | |
void | initialize () |
template<class T1 > | |
void | initialize (T1 &a) |
template<class T1 , class T2 > | |
void | initialize (T1 &a, T2 &b) |
template<class T1 , class T2 , class T3 > | |
void | initialize (T1 &a, T2 &b, T3 &c) |
T & | operator[] (int n) |
const T & | operator[] (int n) const |
It appears to other objects like an array of objects of type T, with a fixed number of elements Dim. It provides an operator[] for accessing the Nth element. The type 'Elem' should (but does not have to be) some kind of elementary type, like int or char.
UninitializedVector is used primarily by the Domain objects to store N 1-D domain objects, so that T is something like Interval<1>. In that case, we often wish to avoid running the default constructors on the domain array elements, since they will be overwritten with new values when the array is filled in with correct values. UninitializedVector uses a simple array to provide the storage for the N objects, so that the default constructor for UninitializedVector (the only one publicly available) does not do anything. If you want to run the default constructors for the domain objects, the 'initialize' method is available, which can take 0, 1, 2, or 3 arguments. initialize uses simple template meta-programs 'InitializeUninitializedVectorN' to perform the initialization of the elements, by using the placement new operator.
When used, UninitializedVector should allow you to have an array of fixed length which is not initialized in any way until you call initialize. And when initialize is called, the loop to call the constructors for the objects in the array should be unrolled and inlined by the template metaprogram used to call the constructors.
UninitializedVector< T, Dim, Elem >::UninitializedVector | ( | ) | [inline] |
References CTAssert.
UninitializedVector< T, Dim, Elem >::~UninitializedVector | ( | ) | [inline] |
void UninitializedVector< T, Dim, Elem >::initialize | ( | ) | [inline] |
Referenced by UninitializedVector< T, Dim, Elem >::initialize().
void UninitializedVector< T, Dim, Elem >::initialize | ( | T1 & | a | ) | [inline] |
void UninitializedVector< T, Dim, Elem >::initialize | ( | T1 & | a, | |
T2 & | b | |||
) | [inline] |
void UninitializedVector< T, Dim, Elem >::initialize | ( | T1 & | a, | |
T2 & | b, | |||
T3 & | c | |||
) | [inline] |
T& UninitializedVector< T, Dim, Elem >::operator[] | ( | int | n | ) | [inline] |
References PAssert.
const T& UninitializedVector< T, Dim, Elem >::operator[] | ( | int | n | ) | const [inline] |
References PAssert.