Is lazy initialization really possible with static data members?
问题 Is it possible to initialize the Instance of a Singleton when it is really needed? Consider this pattern taken from the famous "Design Patterns": class Singleton { public: static Singleton* Instance(); protected: Singleton(); private: static Singleton* _instance; } Singleton* Singleton::_instance = 0; // unit.cpp static Singleton* Singleton::Instance() { if (_instance == 0) { _instance = new Singleton; } return _instance; } Now, I think there is a problem in the pattern there, if one desires