Files
FlaxEngine/Source/Engine/Core/Singleton.h
2023-01-10 15:29:37 +01:00

38 lines
473 B
C++

// Copyright (c) 2012-2023 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;
}
};