#pragma once /** * @brief The Singleton class */ template class Singleton { public: static T *getInstance(); }; template T *Singleton::getInstance() { static T *instance = new T(); return instance; } #define SINGLETON(Class) \ private: \ friend class Singleton; \ public: \ static Class* getInstance() { \ return Singleton::getInstance(); \ }