#include <stlsoft/util/pod_veneer.hpp>
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 class applied during construction | |
DF | The function class applied during destruction |
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 class. | |
typedef DF | destructor_function_type |
The destructor function class. | |
typedef pod_veneer< T, CF, DF > | class_type |
The type of the current parameterisation. | |
Public Member Functions | |
pod_veneer () | |
The constructor, within which CF is applied to this . | |
~pod_veneer () throw () | |
The destructor, within which DF is applied to this . |
typedef T value_type |
The value type.
typedef T pod_type |
The Plain Old Data type.
typedef CF constructor_function_type |
The constructor function class.
typedef DF destructor_function_type |
The destructor function class.
typedef pod_veneer<T, CF, DF> class_type |
The type of the current parameterisation.
pod_veneer | ( | ) | [inline] |
The constructor, within which CF is applied to this
.
~pod_veneer | ( | ) | throw () [inline] |
The destructor, within which DF is applied to this
.
References STLSOFT_ASSERT, and STLSOFT_MESSAGE_ASSERT.