mirror of
https://github.com/0TheSpy/Seaside.git
synced 2025-01-05 17:13:40 +08:00
29 lines
449 B
C++
29 lines
449 B
C++
#ifndef SINGLETON
|
|
#define SINGLETON
|
|
#pragma once
|
|
|
|
|
|
template<typename T>
|
|
class Singleton
|
|
{
|
|
protected:
|
|
Singleton() {}
|
|
~Singleton() {}
|
|
|
|
Singleton(const Singleton&) = delete;
|
|
Singleton& operator=(const Singleton&) = delete;
|
|
|
|
Singleton(Singleton&&) = delete;
|
|
Singleton& operator=(Singleton&&) = delete;
|
|
|
|
public:
|
|
static T& Get()
|
|
{
|
|
static T inst{};
|
|
return inst;
|
|
}
|
|
};
|
|
|
|
|
|
#endif
|