mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-01-16 03:45:13 +00:00
26 lines
383 B
C++
26 lines
383 B
C++
#pragma once
|
|
|
|
#include <memory>
|
|
|
|
namespace Common {
|
|
|
|
template <class T>
|
|
class Singleton {
|
|
public:
|
|
static T* Instance() {
|
|
if (!m_instance) {
|
|
m_instance = std::make_unique<T>();
|
|
}
|
|
return m_instance.get();
|
|
}
|
|
|
|
protected:
|
|
Singleton();
|
|
~Singleton();
|
|
|
|
private:
|
|
static inline std::unique_ptr<T> m_instance{};
|
|
};
|
|
|
|
} // namespace Common
|