1234567891011121314151617181920212223 |
- #pragma once
- #include <type_traits>
- template <typename T>
- class CSingletonBase
- {
- public:
- static T &get_instance() noexcept(std::is_nothrow_constructible<T>::value)
- {
- static T instance;
- return instance;
- }
- virtual ~CSingletonBase() noexcept
- {
- }
- CSingletonBase(const CSingletonBase &) = delete;
- CSingletonBase &operator=(const CSingletonBase &) = delete;
- protected:
- CSingletonBase()
- {
- }
- };
|