#ifndef SINGLETON_H_INCLUDED #define SINGLETON_H_INCLUDED #include #include #include #include namespace Loki { template struct SingletonHolder { static T& Instance() { static std::once_flag onceFlag; static std::unique_ptr singleton; std::call_once(onceFlag, [] { singleton = std::make_unique(); }); return *singleton.get(); } }; } #endif