diff --git a/CommonLibF4/include/REX/REX.h b/CommonLibF4/include/REX/REX.h index 9bdc966f..b7b8aa04 100644 --- a/CommonLibF4/include/REX/REX.h +++ b/CommonLibF4/include/REX/REX.h @@ -167,3 +167,27 @@ namespace REX std::underlying_type_t< std::common_type_t>>; } + +namespace REX +{ + template + class Singleton + { + public: + static T* GetSingleton() + { + static T singleton; + return std::addressof(singleton); + } + + protected: + Singleton() = default; + ~Singleton() = default; + + Singleton(const Singleton&) = delete; + Singleton(Singleton&&) = delete; + + Singleton& operator=(const Singleton&) = delete; + Singleton& operator=(Singleton&&) = delete; + }; +}