From d033400614e7e2c0ff49e5100c81e937e5818e74 Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 28 Jul 2018 13:47:51 +0800 Subject: *update --- src/libjin/common/singleton.h | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 src/libjin/common/singleton.h (limited to 'src/libjin/common/singleton.h') diff --git a/src/libjin/common/singleton.h b/src/libjin/common/singleton.h deleted file mode 100644 index ff8a9ce..0000000 --- a/src/libjin/common/singleton.h +++ /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() {}; - private: - Singleton(const Singleton&); - Singleton& operator = (const Singleton&); - - static T* _instance; - }; - - template T* Singleton::_instance = nullptr; - -#define SINGLETON(T) \ - friend Singleton - -} // jin - -#endif \ No newline at end of file -- cgit v1.1-26-g67d0