Singleton Class Template Reference
[Design patterns]
#include <ql/Patterns/singleton.hpp>
List of all members.
Detailed Description
template<class T>
class QuantLib::Singleton< T >
Basic support for the singleton pattern.
The typical use of this class is: class Foo : public Singleton<Foo> {
friend class Singleton<Foo>;
private:
Foo() {}
public:
...
};
which, albeit sub-optimal, frees one from the concerns of creating and managing the unique instance and can serve later as a single implemementation point should synchronization features be added.
If the derived class provides an initialize() method, it will be called after creation of the unique instance.
|
Static Public Member Functions |
T & | instance () |
| access to the unique instance
|
Protected Member Functions |
void | initialize () |
|