SDC C-Project CF Review 프로그램
LYW
2021-09-14 ffe71aadfdcb4a9ea2ac4d8d320983d42ef3cad5
ReviewHistory/ReveiwHistory/Singleton.h
새 파일
@@ -0,0 +1,35 @@
#pragma once
template <typename T>
class CSingleton
{
public:
   CSingleton() {}
   virtual ~CSingleton() {}
   static void CreateClass()
   {
      if ( !m_pMgr )
         m_pMgr = new T;
   }
   static void DestroyClass()
   {
      if ( m_pMgr )
      {
         delete m_pMgr;
         m_pMgr = NULL;
      }
   }
   static T* GetMgr()
   {
      return m_pMgr;
   }
private:
   static T* m_pMgr;
};
template<typename T> T* CSingleton<T>::m_pMgr = NULL;