diff options
author | chai <chaifix@163.com> | 2018-10-23 12:23:58 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-10-23 12:23:58 +0800 |
commit | 40fc27154fe754181934dc7ee31375e6bdfb33fc (patch) | |
tree | 897ad98d759bc308ef66561181ba88b85f2ccd47 /src/libjin/Common/Singleton.hpp | |
parent | 1480c9445100075c9e1a894eb07c0ef727b509a1 (diff) |
*merge from minimal
Diffstat (limited to 'src/libjin/Common/Singleton.hpp')
-rw-r--r-- | src/libjin/Common/Singleton.hpp | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/src/libjin/Common/Singleton.hpp b/src/libjin/Common/Singleton.hpp deleted file mode 100644 index 48cd5bc..0000000 --- a/src/libjin/Common/Singleton.hpp +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef __JIN_SINGLETON_H -#define __JIN_SINGLETON_H - -namespace jin -{ - - template<class T> - class Singleton - { - public: - static T* get() - { - if (_instance == nullptr) - _instance = new T; - return _instance; - } - static void destroy() - { - delete _instance; - _instance = nullptr; - } - protected: - Singleton() {}; - virtual ~Singleton() {}; - static T* _instance; - private: - Singleton(const Singleton&); - Singleton& operator = (const Singleton&); - }; - - template<class T> T* Singleton<T>::_instance = nullptr; - -#define SINGLETON(T) \ - friend Singleton<T> - -} // jin - -#endif // __JIN_SINGLETON_H
\ No newline at end of file |