23 static void Destroy(T* obj) {
delete obj; }
33 alignas(
alignof(T))
static char buf[
sizeof(T)];
37 static void Destroy(T* obj) { obj->~T(); }
119 template <
class>
class CreationPolicy = policy::CreateStatic,
120 template <
class>
class LifetimePolicy = policy::DefaultLifetime,
121 template <
class>
class ThreadingModel = policy::SingleThreaded
151#include "smgl/SingletonImpl.hpp"
Class for constructing and managing the lifetime of a singleton object.
static InstanceType * instance_
typename ThreadingModel< T >::VolatileType InstanceType
static T & Instance()
Access the singleton instance.
static void DestroySingleton()
Lifetime policy which reconstructs a destroyed singleton if reaccessed.
static void ScheduleDestruction(AtExitFunc destructionFn)
static void OnDeadReference()
void(*)() AtExitFunc
Alias for a function type that can be passed to std::atexit.
Project top-level namespace.
Creation policy which allocates a static object.
static void Destroy(T *obj)
Creation policy that uses new to allocate an object on the stack.
static void Destroy(T *obj)
Lifetime policy which schedules destruction using std::atexit.
static void ScheduleDestruction(AtExitFunc destructionFn)
static void OnDeadReference()
Single-threaded lock type which does nothing.
Threading policy for single-threaded applications.