19 lines
333 B
C++
19 lines
333 B
C++
#ifndef SINGLETON_H
|
|
#define SINGLETON_H
|
|
|
|
template <typename T>
|
|
class Singleton {
|
|
public:
|
|
static T& GetInstance() {
|
|
static T instance;
|
|
return instance;
|
|
}
|
|
Singleton(const Singleton&) = delete;
|
|
Singleton& operator=(const Singleton&) = delete;
|
|
|
|
protected:
|
|
Singleton() {}
|
|
~Singleton() {}
|
|
};
|
|
|
|
#endif |