#ifndef SINGLETON_H #define SINGLETON_H #include "../businessLogic.h" #include BEGIN_NAMESPACE(BusinessLogic) BEGIN_NAMESPACE(Pattern) template class Singleton { private: static std::unique_ptr m_singleton; public: static const T &getInstance() { if (m_singleton == nullptr) { m_singleton = std::unique_ptr(new T); } return m_singleton.operator*(); } Singleton() = default; Singleton(const Singleton &) = delete; Singleton(Singleton &&) = delete; Singleton &operator=(const Singleton &) = delete; Singleton &operator=(Singleton &&) = delete; }; template std::unique_ptr Singleton::m_singleton = nullptr; END_NAMESPACE // Pattern END_NAMESPACE // BusinessLogic #endif // SINGLETON_H