template<class T>
class Dune::Singleton< T >
An adapter to turn a class into a singleton.
The class represented by the template parameter T must have a parameterless constructor.
Class T can be publicly derived from Singleton<T>:
{
public:
Foo()
{
bytes = new char[1000];
}
~Foo()
{
delete[] bytes;
}
private:
char* bytes;
};
Useful wrapper for creating singletons.
An adapter to turn a class into a singleton.
Definition singleton.hh:56
Or one can construct a Singleton of an existing class. Say Foo1 is a class with parameterless constructor then
Foo1
instance& = FooSingleton::instance();
static DUNE_EXPORT T & instance()
Get the instance of the singleton.
Definition singleton.hh:70
Creates a singleton of that class and accesses its instance.