pod_veneer Class Template Reference

#include <stlsoft/util/pod_veneer.hpp>

List of all members.


Detailed Description

template<typename T, typename CF, typename DF>
class stlsoft::pod_veneer< T, CF, DF >

Bolts construction and/or destruction to Plain Old Data types.

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

Parameters:
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.

Member Typedef Documentation

typedef T value_type

The value type.

typedef T pod_type

The Plain Old Data type.

The constructor function class.

The destructor function class.

typedef pod_veneer<T, CF, DF> class_type

The type of the current parameterisation.


Constructor & Destructor Documentation

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.


The documentation for this class was generated from the following file:

Generated on Thu Jun 10 08:59:03 2010 for STLSoft by  doxygen 1.5.6