21 #ifndef GF_SINGLETON_H
22 #define GF_SINGLETON_H
30 #ifndef DOXYGEN_SHOULD_SKIP_THIS
35 class SingletonStorage;
118 return m_single !=
nullptr;
150 class SingletonStorage {
159 template<
typename ... Args>
161 : m_storage(std::forward<Args>(args)...) {
162 assert(ref.m_single ==
nullptr);
163 ref.m_single = &m_storage;
170 #ifndef DOXYGEN_SHOULD_SKIP_THIS
void reset() noexcept
Reset the singleton.
Definition: Singleton.h:108
friend class RenderTarget
Definition: Shader.h:387
Singleton & operator=(Singleton &&)=delete
Deleted move assignment.
Singleton(Singleton &&)=delete
Deleted move constructor.
T & operator()()
Access the singleton.
Definition: Singleton.h:98
Singleton()
Default constructor.
Definition: Singleton.h:65
Singleton(const Singleton &)=delete
Deleted copy constructor.
bool isValid() const noexcept
Check if the singleton has been initialized.
Definition: Singleton.h:117
Singleton & operator=(const Singleton &)=delete
Deleted copy assignment.
SingletonStorage(Singleton< T > &ref, Args &&...args)
Construct a storage for a singleton.
Definition: Singleton.h:160
A singleton that wraps a pointer provided by a storage.
Definition: Singleton.h:57