Files
FlaxEngine/Source/Engine/Core/Singleton.h
2022-01-14 13:31:12 +01:00

38 lines
473 B
C++

// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
#pragma once
template<class T>
class Singleton
{
private:
Singleton(Singleton const&)
{
}
Singleton& operator=(Singleton const&)
{
return *this;
}
protected:
Singleton()
{
}
~Singleton()
{
}
public:
// Gets instance of the singleton type object
static T* Instance()
{
static T _instance;
return &_instance;
}
};