summaryrefslogtreecommitdiff
path: root/source/libs/asura-lib-utils/singleton.hpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-06-06 00:12:17 +0800
committerchai <chaifix@163.com>2019-06-06 00:12:17 +0800
commit8bfe54676f728076a92d802bb5d064e58265c8f2 (patch)
tree5d8ea1bd063f2d01dc979915db546449d68277bf /source/libs/asura-lib-utils/singleton.hpp
parent88b882ed0b432c6aff2063213e2f793a36dd25f7 (diff)
-文件夹名
Diffstat (limited to 'source/libs/asura-lib-utils/singleton.hpp')
-rw-r--r--source/libs/asura-lib-utils/singleton.hpp59
1 files changed, 0 insertions, 59 deletions
diff --git a/source/libs/asura-lib-utils/singleton.hpp b/source/libs/asura-lib-utils/singleton.hpp
deleted file mode 100644
index 0d2777e..0000000
--- a/source/libs/asura-lib-utils/singleton.hpp
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef __ASURA_SINGLETON_H__
-#define __ASURA_SINGLETON_H__
-
-#include "utils_config.h"
-
-namespace AsuraEngine
-{
-
- ///
- /// ̳Singletonڵһʵʱʵ֮ٴʵᱨ
- ///
- template<class T>
- class Singleton
- {
- public:
-
- static T* Get()
- {
- // ֮ǰûдһ
- if (!instance) instance = new T;
- // ʵ
- return instance;
- }
-
- static void Destroy()
- {
- delete instance;
- instance = nullptr;
- }
-
- protected:
-
- Singleton()
- {
- // instanceζִһʵǴġ
- ASSERT(!instance);
- // 򣬽ʵΪʵ
- 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;
-
-}
-
-#endif // __ASURA_SINGLETON_H__ \ No newline at end of file