diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 908ae83..5bfa897 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -11,7 +11,11 @@ - + + + + + diff --git a/inc/utils.h b/inc/utils.h index d1cc199..c02c7a9 100644 --- a/inc/utils.h +++ b/inc/utils.h @@ -21,4 +21,5 @@ using namespace std; } string itos(int x); + #endif //CUTILS_UTILS_H diff --git a/src/pattern/signleton.h b/src/pattern/signleton.h index e03b5c0..c279246 100644 --- a/src/pattern/signleton.h +++ b/src/pattern/signleton.h @@ -12,18 +12,20 @@ using namespace std; template class Singletone { public: - static T& Instance(){ + static T* Instance(){ if(mInstance.get() == nullptr){ - mInstance = std::unique_ptr(); + mInstance = std::unique_ptr(new T); } return mInstance.get(); } private: - Singletone(){}; - ~Singletone(){}; - Singletone &operator=(const Singletone&){}; + Singletone(){} + ~Singletone(){} + Singletone &operator=(const Singletone&){} static unique_ptr mInstance; }; +template +unique_ptr Singletone::mInstance; #define DECLARE_SINGLETON(type) \ friend class unique_ptr ; \