Singleton construction via the curiously recurring template pattern. More...
#include <singleton.hpp>
Public Member Functions | |
virtual | ~Singleton () |
Static Public Member Functions | |
static T & | instance () |
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;
Definition at line 51 of file singleton.hpp.
virtual ecl::Singleton< T >::~Singleton | ( | ) | [inline, virtual] |
Definition at line 65 of file singleton.hpp.
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.