I am trying to a singleton mymap class. I have declared a private *pInstance pointer. I am having problems in defining the pInstance pointer. Somehow I am not getting the syntax right. Please help me define the pInstance pointer. I tried this definition template<> assoc<string, string>::*pInstance; Code: template<class A, class B> class myclass { public: .... private: static myclass<A, B> *pInstance; myclass() { if(pInstance==NULL) pInstance = new myclass<A, B>; } }; template<> assoc<string, string>::*pInstance; //this is giving errors during build try.cpp Code: typedef myclass<string, string> StrStrMap; int main() { StrStrMap a; .... }
Also, instead of using a pInstance pointer, I use a pInstance object what will be the pInstance definition