|
Easy Navigation
|
#include <Singleton.hpp>
Static Public Member Functions | |
| template<typename ... Args> | |
| static C & | get (Args &&... args) |
| template<typename ... Args> | |
| static C * | getInstance (Args &&... args) |
| static void | removeInstance () |
| Destroy the current instance, if any; the next getInstance()/get() call creates a fresh one. | |
Protected Member Functions | |
| Singleton & | operator= (const Singleton &)=delete |
| Singleton ()=default | |
| Singleton (const Singleton &)=delete | |
| ~Singleton ()=default | |
|
protecteddefault |
|
protecteddefault |
|
protecteddelete |
|
static |
|
static |
|
static |
Destroy the current instance, if any; the next getInstance()/get() call creates a fresh one.
C* obtained from an earlier getInstance()/get() call – that pointer's lifetime is tied to the destroyed instance, and no amount of locking here can protect a caller who is already holding and using it (the lock only serializes this class's own instance_/mutex_ bookkeeping against concurrent getInstance()/ removeInstance() calls). Intended for sequential use, e.g. resetting singleton state between test cases, not for tearing down an instance while it may still be in use elsewhere.