DarkflameServer/dCommon/Singleton.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
396 B
C
Raw Permalink Normal View History

#pragma once
template <typename T>
class Singleton {
public:
static T& Instance() {
static T instance{};
return instance;
}
virtual ~Singleton() = default;
Singleton(const Singleton& other) = delete;
Singleton(Singleton&& other) = delete;
Singleton& operator=(const Singleton& other) = delete;
Singleton& operator=(Singleton&& other) = delete;
protected:
Singleton() = default;
};