|
|
|
|
|
|
|
|
|
|
|
|||||||
#include <stlsoft_pod_veneer.h>
Public Types | |
| typedef T | value_type |
| The value type. | |
| typedef T | pod_type |
| The Plain Old Data type. | |
| typedef CF | constructor_function_type |
| The constructor function object type. | |
| typedef DF | destructor_function_type |
| The destructor function object type. | |
| typedef pod_veneer< T, CF, DF > | class_type |
| The type of the current parameterisation. | |
Public Methods | |
| pod_veneer () | |
The constructor, within which CF is applied to this. | |
| ~pod_veneer () | |
The destructor, within which DF is applied to this. | |
The parameterisation of this veneer can be used to apply RRID or RAII semantics to a plain old data type. For example,
struct Simple
{
public:
char *buffer;
};
void Init_Simple(Simple *simple);
void Uninit_Simple(Simple *simple);
struct Simple_Init { void operator()(Simple *simple) { Init_Simple(simple); } };
struct Simple_Uninit { void operator()(Simple *simple) { Uninit_Simple(simple); } };
void fn()
{
typedef pod_veneer<Simple, Simple_Init, Simple_Uninit> Simple_raii_t;
Simple_raii_t simple; // Init_Simple() called here
. . .
} // Uninit_Simple() called here
| T | The POD type |
| CF | The function object type applied during construction |
| DF | The function object type applied during destruction |
|
|
The type of the current parameterisation.
|
|
|
The constructor function object type.
|
|
|
The destructor function object type.
|
|
|
The Plain Old Data type.
|
|
|
The value type.
|
|
|
The constructor, within which CF is applied to
|
|
|
The destructor, within which DF is applied to
|
|
|
| STLSoft Libraries documentation © Synesis Software Pty Ltd, 2001-2004 |