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 |
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.
Definition at line 346 of file generics.h.
ucommon::temp_array< T >::temp_array | ( | const T & | initial, | |
size_t | s | |||
) | [inline] |
Construct a temporary object with a copy of some initial value.
initial | object value to use. |
Definition at line 363 of file generics.h.