ucommon::temp_array< T > Class Template Reference

Manage temporary array stored on the heap. More...

#include <generics.h>

Public Member Functions

 operator bool () const
bool operator! () const
T * operator() (size_t offset) const
T & operator[] (size_t offset) const
void reset (const T &initial, size_t s)
void reset (size_t s)
void set (const T &initial)
 temp_array (const temp_array< T > &)
 Disable copy constructor.
 temp_array (const T &initial, size_t s)
 Construct a temporary object with a copy of some initial value.
 temp_array (size_t s)
 Construct a temporary object, create our stack frame reference.

Protected Attributes

T * array
size_t size

Detailed Description

template<typename T>
class ucommon::temp_array< T >

Manage temporary array stored on the heap.

This is used to create an array on the heap who's scope is controlled by the scope of a member function call. Sometimes we have data types and structures which cannot themselves appear as auto variables. We may also have a limited stack frame size in a thread context, and yet have a dynamic object that we only want to exist during the life of the method call. Using temporary allows any type to be created from the heap but have a lifespan of a method's stack frame.

Author:
David Sugar <dyfet@gnutelephony.org>

Definition at line 346 of file generics.h.


Constructor & Destructor Documentation

template<typename T >
ucommon::temp_array< T >::temp_array ( const T &  initial,
size_t  s 
) [inline]

Construct a temporary object with a copy of some initial value.

Parameters:
initial object value to use.

Definition at line 363 of file generics.h.


The documentation for this class was generated from the following file:
Generated on Thu Jul 14 16:40:08 2011 for ucommon by  doxygen 1.6.3