diff options
author | chai <chaifix@163.com> | 2021-10-17 16:01:30 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-10-17 16:01:30 +0800 |
commit | 6e73ca6ada8a41692809dae5db89c8db0675ce1e (patch) | |
tree | 3ca6f06b29b3e2c183750ddcff8d7a09d0785e6b /Runner/Utilities/Singleton.h | |
parent | e13f699ee5f575198552d94ada1167305c82bb2f (diff) |
-Runner
Diffstat (limited to 'Runner/Utilities/Singleton.h')
-rw-r--r-- | Runner/Utilities/Singleton.h | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/Runner/Utilities/Singleton.h b/Runner/Utilities/Singleton.h deleted file mode 100644 index 65c9e60..0000000 --- a/Runner/Utilities/Singleton.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef SINGLETON_H -#define SINGLETON_H - -template<class T> -class Singleton -{ -public: - - static T* Instance() - { - if (!instance) instance = new T; - return instance; - } - - static void Destroy() - { - delete instance; - instance = nullptr; - } - -protected: - - Singleton() - { - instance = static_cast<T*>(this); - }; - - virtual ~Singleton() {}; - - static T* instance; - -private: - - Singleton(const Singleton& singleton); - - Singleton& operator = (const Singleton& singleton); - -}; - -template<class T> -T* Singleton<T>::instance = nullptr; - -#define Get(T) T::Instance() - -#endif
\ No newline at end of file |