]> git.mxchange.org Git - simgear.git/blob - simgear/structure/Singleton.hxx
Boolean uniforms are now updatable by properties
[simgear.git] / simgear / structure / Singleton.hxx
1 #ifndef SIMGEAR_SINGLETON_HXX
2 #define SIMGEAR_SINGLETON_HXX 1
3
4 #include "singleton.hpp"
5
6 namespace simgear
7 {
8 /**
9  * Class that supplies the address of a singleton instance. This class
10  * can be inherited by its Class argument in order to support the
11  * instance() method in that class.
12  */
13 template <typename Class>
14 class Singleton
15 {
16 protected:
17     Singleton() {}
18 public:
19     static Class* instance()
20     {
21         Class& singleton
22             = boost::details::pool::singleton_default<Class>::instance();
23         return &singleton;
24     }
25 };
26
27 }
28 #endif