|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
A minimal singleton class implementation. More...
#include <ahSingleton.H>
Public Member Functions | |
Deleted copy and move operations | |
| Singleton (const Singleton &)=delete | |
| Singleton (Singleton &&)=delete | |
| Singleton & | operator= (const Singleton &)=delete |
| Singleton & | operator= (Singleton &&)=delete |
Static Public Member Functions | |
| static Singleton & | get_instance () noexcept |
| Returns the unique instance of the Singleton. | |
Private Member Functions | |
| Singleton ()=default | |
| Private constructor to prevent direct instantiation. | |
A minimal singleton class implementation.
This class demonstrates the Meyers singleton pattern and can be used directly when a simple singleton with no additional state or behavior is needed.
For singletons with custom state or behavior, prefer using the Make_Singleton macro on your own class.
Thread-safe initialization is guaranteed by the C++11 standard for function-local static variables.
Definition at line 177 of file ahSingleton.H.
|
delete |
|
delete |
|
privatedefault |
Private constructor to prevent direct instantiation.
|
inlinestaticnoexcept |
Returns the unique instance of the Singleton.
The instance is created on the first call (lazy initialization) and the same instance is returned on all subsequent calls.
Definition at line 191 of file ahSingleton.H.