Public Member Functions | Static Public Member Functions
ecl::Singleton< T > Class Template Reference

Singleton construction via the curiously recurring template pattern. More...

#include <singleton.hpp>

List of all members.

Public Member Functions

virtual ~Singleton ()

Static Public Member Functions

static T & instance ()

Detailed Description

template<typename T>
class ecl::Singleton< T >

Singleton construction via the curiously recurring template pattern.

This class doesn't provide singletons, but enables the construction of referenced based singletons via the curiously recurring template pattern.

If you wish to create a singleton, simply:

 #define Test TestObject::instance()

 ...

 cout << Test.value() << endl;
See also:
src/test/singleton.cpp, Singletons

Definition at line 51 of file singleton.hpp.


Constructor & Destructor Documentation

template<typename T >
virtual ecl::Singleton< T >::~Singleton ( ) [inline, virtual]

Definition at line 65 of file singleton.hpp.


Member Function Documentation

template<typename T >
static T& ecl::Singleton< T >::instance ( ) [inline, static]

Stores a reference to a single instantiation of the template object. If the template class has a protected or private default constructor (no arguments), then it ensures the class will be a singleton itself.

Definition at line 59 of file singleton.hpp.


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


ecl_utilities
Author(s): Daniel Stonier (d.stonier@gmail.com)
autogenerated on Thu Jan 2 2014 11:12:21