/* * singleton.h * * Created on: Sep 11, 2019 * Author: compi */ #ifndef SINGLETON_H_ #define SINGLETON_H_ #include namespace f4ll_cpp { template class Singleton { public: static T &Instance() { static T instance; return instance; } protected: Singleton() = default; Singleton(const Singleton &) = delete; Singleton &operator=(const Singleton &) = delete; virtual ~Singleton() = default; static T *m_instance; }; template T* Singleton::m_instance = nullptr; } // f4ll_cpp #endif /* SINGLETON_H_ */