#ifndef ___SINGLETON_H__ #define ___SINGLETON_H__ #include template class Singleton { private: static std::auto_ptr instance; Singleton(const Singleton& rval){} public: Singleton(){} virtual ~Singleton(){} static T *me() { if (!instance.get()) instance.reset(new T()); return instance.get(); } }; template std::auto_ptr Singleton::instance; #endif // ___SINGLETON_H__