#pragma once #include namespace creeper::util { template class Singleton { public: static T& instance(); Singleton(const Singleton&) = delete; Singleton& operator=(const Singleton&) = delete; protected: struct token { }; Singleton() = default; }; template inline T& Singleton::instance() { static const std::unique_ptr instance { new T { token {} } }; return *instance; } }