Object Management Trickery


Detailed Description

These functions are to construct and destruct objects in memory without causing a free or malloc call to occur.

This is so that we don't have to worry about allocating, say, space for a hundred NetAddresses with a single malloc call, calling delete on a single NetAdress, and having it try to free memory out from under us.


Functions

template<class T>
T * constructInPlace (T *p)
 Constructs an object that already has memory allocated for it.
template<class T>
T * constructInPlace (T *p, const T *copy)
 Copy constructs an object that already has memory allocated for it.
template<class T, class T2>
T * constructInPlace (T *ptr, T2 t2)
template<class T, class T2, class T3>
T * constructInPlace (T *ptr, T2 t2, T3 t3)
template<class T, class T2, class T3, class T4>
T * constructInPlace (T *ptr, T2 t2, T3 t3, T4 t4)
template<class T, class T2, class T3, class T4, class T5>
T * constructInPlace (T *ptr, T2 t2, T3 t3, T4 t4, T5 t5)
template<class T>
void destructInPlace (T *p)
 Destructs an object without freeing the memory associated with it.


Function Documentation

template<class T>
T* constructInPlace ( T *  p  )  [inline]

Constructs an object that already has memory allocated for it.

template<class T>
T* constructInPlace ( T *  p,
const T *  copy 
) [inline]

Copy constructs an object that already has memory allocated for it.

template<class T, class T2>
T* constructInPlace ( T *  ptr,
T2  t2 
) [inline]

template<class T, class T2, class T3>
T* constructInPlace ( T *  ptr,
T2  t2,
T3  t3 
) [inline]

template<class T, class T2, class T3, class T4>
T* constructInPlace ( T *  ptr,
T2  t2,
T3  t3,
T4  t4 
) [inline]

template<class T, class T2, class T3, class T4, class T5>
T* constructInPlace ( T *  ptr,
T2  t2,
T3  t3,
T4  t4,
T5  t5 
) [inline]

template<class T>
void destructInPlace ( T *  p  )  [inline]

Destructs an object without freeing the memory associated with it.