Files
GP1-DirectX/project/src/Singleton.h

31 lines
564 B
C++

//
// Created by Bram on 16/01/2025.
//
#ifndef GP1_DIRECTX_SINGLETON_H
#define GP1_DIRECTX_SINGLETON_H
template<typename T>
class Singleton {
public:
static T &GetInstance() {
static T instance{};
return instance;
}
virtual ~Singleton() = default;
Singleton(Singleton &&other) = delete;
Singleton(const Singleton &other) = delete;
Singleton &operator=(Singleton &&other) = delete;
Singleton &operator=(const Singleton &other) = delete;
protected:
Singleton() = default;
};
#endif //GP1_DIRECTX_SINGLETON_H