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

Deferrer Struct Template Reference
[Utility constructs for Vaucanson]

This class defers the creation of its template parameter. More...

Inheritance diagram for Deferrer:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 Deferrer ()
 Constructor.

Deferreroperator= (const deferred_type &)
 Effectively builds the holded type.

 operator T () const
 Get back the holded type.


Protected Attributes

data_t data
 A flat area of memory big enough to hold an instance of deferred_type.


Detailed Description

template<class T, bool rt_checks = deferrer_runtime_checks_default>
struct utility::Deferrer< T, rt_checks >

This class defers the creation of its template parameter.

This class is designed to hold a instance of type T, without initializing it when the class is created. In fact, the construction of T is deferred to a later time, using operator=. This may be usefull when you want to equip a class with a constructor without arguments.

Using a Deferrer may be dangerous, e.g. when you make a call to the cast operator without having initialized the referred type with a call to operator=.

Because of that danger, you can optionally enable or disable some runtime checks by respectively set or clear a second Boolean template parameter.

When you compile without the NDEBUG macro, this parameter defaults to true (checks enabled). Else it defaults to false (checks disabled).

Author:
Thomas Claveirole


Member Data Documentation

data_t data [protected]
 

A flat area of memory big enough to hold an instance of deferred_type.

Using this kind of trick forces us to do a lot of ugly casts (after all, data_t is just an array of char), but as a result there are no dynamic allocations.


Generated on Mon Mar 29 15:42:43 2004 for Vaucanson by doxygen 1.3.6-20040222