xoreos  0.0.5
Classes | Namespaces | Macros
singleton.h File Reference

Class and macro for implementing singletons. More...

#include <boost/noncopyable.hpp>
Include dependency graph for singleton.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Common::Singleton< T >
 Generic template base class for implementing the singleton design pattern. More...
 

Namespaces

 Common
 

Macros

#define DECLARE_SINGLETON(T)
 Note that you need to use this macro from the global namespace. More...
 

Detailed Description

Class and macro for implementing singletons.

Definition in file singleton.h.

Macro Definition Documentation

◆ DECLARE_SINGLETON

#define DECLARE_SINGLETON (   T)
Value:
namespace Common { \
template<> T *Singleton<T>::_singleton = 0; \
}
Definition: 2dafile.h:39
Aurora::TwoDARegistry * _singleton
Definition: 2dareg.cpp:35

Note that you need to use this macro from the global namespace.

This is because C++ requires initial explicit specialization to be placed in the same namespace as the template. It has to be put in the global namespace to assure the correct namespace Common is referenced.

Definition at line 122 of file singleton.h.