#ifndef SINGLETON_H #define SINGLETON_H #include #includeSingleton.cppclass Singleton { public: static Singleton& GetInstance(); Singleton(const Singleton&) = delete; Singleton operator=(const Singleton&) = delete; ~Singleton() {} private: Singleton() {} }; #endif
#include "Singleton.h"
static std::mutex g_mtx = {};
Singleton& Singleton::GetInstance()
{
std::unique_lock lock(g_mtx);
static Singleton singleton;
return singleton;
}



