Get rid of Loki

This commit is contained in:
vladislav.khorev committed 2018-09-23 10:57:34 +05:00
1 parent 15a2cbe410
commit ef0392fb63
27 files changed
+92 -52

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
#ifndef SINGLETON_H_INCLUDED
#define SINGLETON_H_INCLUDED
#include <memory>
#include <cassert>
#include <thread>
#include <mutex>
namespace Loki
{
template <typename T>
struct SingletonHolder
{
static T& Instance()
{
static std::once_flag onceFlag;
static std::unique_ptr<T> singleton;
std::call_once(onceFlag,
[] {
singleton = std::make_unique<T>();
});
return *singleton.get();
}
};
}
#endif