What is correct way to initialize a static member of type 'T &' in a templated class?
I'm playing around with an eager-initializing generic singleton class. The idea is that you inherit publicly from the class like so: class foo : public singleton<foo> { }; I've learned a lot in the process but I'm stuck right now because it's breaking my Visual Studio 2008 linker. The problem is with the static instance member and/or its initialization. template<class T> class singleton { singleton(); singleton(singleton const &); singleton & operator = (singleton const &); public: static T & instance; }; template<class T> T & T::instance; Any insight would be greatly appreciated! EDIT: With