#ifndef MERT_SINGLETON_H_ #define MERT_SINGLETON_H_ #include namespace MosesTuning { // thread *un*safe singleton. // TODO: replace this with thread-safe singleton. template class Singleton { public: static T* GetInstance() { if (m_instance == NULL) { m_instance = new T; } return m_instance; } static void Delete() { delete m_instance; m_instance = NULL; } private: Singleton(); static T* m_instance; }; template T* Singleton::m_instance = NULL; } #endif // MERT_SINGLETON_H_