FreePOOMA  2.4.1
Public Member Functions
UninitializedVector< T, Dim, Elem > Class Template Reference

UninitializedVector<T,Dim> stores internally an array of object of type 'Elem', of length sizeof(T) * Dim / sizeof(Elem), where T and Elem are some arbitrary types. More...

#include <UninitializedVector.h>

List of all members.

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

Detailed Description

template<class T, int Dim, class Elem>
class UninitializedVector< T, Dim, Elem >

UninitializedVector<T,Dim> stores internally an array of object of type 'Elem', of length sizeof(T) * Dim / sizeof(Elem), where T and Elem are some arbitrary types.

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.


Constructor & Destructor Documentation

template<class T, int Dim, class Elem>
UninitializedVector< T, Dim, Elem >::UninitializedVector ( ) [inline]

References CTAssert.

template<class T, int Dim, class Elem>
UninitializedVector< T, Dim, Elem >::~UninitializedVector ( ) [inline]

Member Function Documentation

template<class T, int Dim, class Elem>
void UninitializedVector< T, Dim, Elem >::initialize ( ) [inline]
template<class T, int Dim, class Elem>
template<class T1 >
void UninitializedVector< T, Dim, Elem >::initialize ( T1 &  a) [inline]
template<class T, int Dim, class Elem>
template<class T1 , class T2 >
void UninitializedVector< T, Dim, Elem >::initialize ( T1 &  a,
T2 &  b 
) [inline]
template<class T, int Dim, class Elem>
template<class T1 , class T2 , class T3 >
void UninitializedVector< T, Dim, Elem >::initialize ( T1 &  a,
T2 &  b,
T3 &  c 
) [inline]
template<class T, int Dim, class Elem>
T& UninitializedVector< T, Dim, Elem >::operator[] ( int  n) [inline]

References PAssert.

template<class T, int Dim, class Elem>
const T& UninitializedVector< T, Dim, Elem >::operator[] ( int  n) const [inline]

References PAssert.


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