#pragma once #include template class singleton { public: static T* instance() { if (!m_instance) { m_instance = std::make_unique(); } return m_instance; } protected: singleton(); ~singleton(); private: static inline std::unique_ptr m_instance{}; };