21 lines
378 B
C++
21 lines
378 B
C++
#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;
|
|
}
|
|
};
|