From 40fc27154fe754181934dc7ee31375e6bdfb33fc Mon Sep 17 00:00:00 2001 From: chai Date: Tue, 23 Oct 2018 12:23:58 +0800 Subject: *merge from minimal --- src/libjin/Common/Singleton.hpp | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 src/libjin/Common/Singleton.hpp (limited to 'src/libjin/Common/Singleton.hpp') 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 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 T* Singleton::_instance = nullptr; - -#define SINGLETON(T) \ - friend Singleton - -} // jin - -#endif // __JIN_SINGLETON_H \ No newline at end of file -- cgit v1.1-26-g67d0