Singleton class template. More...
#include <singleton.h>


Public Member Functions | |
| bool | is_copy () |
| Check for instance copy. | |
Static Public Member Functions | |
| static T & | instance () |
| Obtain a singleton object reference. | |
Singleton class template.
This class template is intended to provide singleton pattern. It is useful for development of classes that should be exist in one instance only.
Usage:
class test: public singleton<test> { friend class singleton<test>; public: void foo(); ... }; ... test &t = test::instance(); t.foo();
| static T& dbp::singleton< T >::instance | ( | ) | [inline, static] |
Obtain a singleton object reference.
If the object was not instanceated, creates the instance. Returns the instance reference.
| bool dbp::singleton< T >::is_copy | ( | ) | [inline] |
Check for instance copy.
If the instance is not created on instance() call, the instance is a copy.