STLSoft - ... Robust, Lightweight, Cross-platform, Template Software ... ATLSTL - Template Software for the Active Template Library COMSTL - The Standard Template Library meets the Component Object Model .netSTL - Standard Template Library meets the Microsoft.NET Common Language Runtime InetSTL - The Standard Template Library meets WinInet MFCSTL - Template Software for the Microsoft Foundation Classes UNIXSTL - Template Software for the UNIX Operating System WinSTL - where the Standard Template Library meets the Win32 API

Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

pod_veneer Class Template Reference

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

#include <stlsoft_pod_veneer.h>

List of all members.

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.


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 object type applied during construction
DF  The function object type applied during destruction


Member Typedef Documentation

typedef pod_veneer<T, CF, DF> class_type
 

The type of the current parameterisation.

typedef CF constructor_function_type
 

The constructor function object type.

typedef DF destructor_function_type
 

The destructor function object type.

typedef T pod_type
 

The Plain Old Data type.

typedef T value_type
 

The value type.


Constructor & Destructor Documentation

pod_veneer   [inline]
 

The constructor, within which CF is applied to this.

~pod_veneer   [inline]
 

The destructor, within which DF is applied to this.


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

STLSoft Libraries documentation © Synesis Software Pty Ltd, 2001-2004