Generic CRTP singleton abstraction. More...
#include <Singleton.hpp>
Static Public Member Functions | |
| template<typename... Args> | |
| static T & | init (Args &&... args) |
| static bool | hasInstance () |
| static T & | instance () |
| static void | destroy () |
Protected Member Functions | |
| Singleton ()=default | |
Generic CRTP singleton abstraction.
T's constructors and destroy should not be public. You then need to friend this class and the std::default_delete<T> class to prevent compilation errors.
|
protecteddefault |
|
static |
| Exception | if called in initialized state to prevent silent destruction of previous instance. |
|
static |
true if already initialized, else false.
|
static |
| Exception | when called in uninitialized state. |
|
static |