A template singleton. More...
#include "singleton.h"
Public Member Functions | |
Singleton (const Singleton< T > &)=delete | |
Singleton & | operator= (const Singleton< T > &)=delete |
Static Public Member Functions | |
static T * | Get () |
Get a pointer to the singleton instance. | |
Protected Member Functions | |
Singleton () | |
Constructor. | |
virtual | ~Singleton () |
Destructor. | |
A template singleton.
This template class can be used to implement the singleton pattern. The underlying object will be destroyed automatically when the process exits.
For a singleton whose lifetime is bounded by the simulation run, not the process, see SimulationSingleton.
To force your class ExampleS
to be a singleton, inherit from Singleton:
Then, to reach the singleton instance, just do
Definition at line 56 of file singleton.h.
|
delete |
|
inlineprotected |
Constructor.
Definition at line 75 of file singleton.h.
|
inlineprotectedvirtual |
Destructor.
Definition at line 80 of file singleton.h.
|
static |
Get a pointer to the singleton instance.
The instance will be automatically deleted when the process exits.
Definition at line 96 of file singleton.h.
|
delete |