17 lines
354 B
C++
17 lines
354 B
C++
#pragma once
|
|
namespace Psc {
|
|
template<typename Derived>
|
|
class Singleton {
|
|
public:
|
|
static Derived *instance() {
|
|
static Derived instance;
|
|
return &instance;
|
|
}
|
|
Singleton(const Singleton &) = delete;
|
|
Singleton &operator=(const Singleton &) = delete;
|
|
protected:
|
|
Singleton() = default;
|
|
~Singleton() = default;
|
|
};
|
|
}
|