List of all members | Static Public Member Functions | Protected Member Functions | Private Member Functions
utl::LeakingSingleton< T > Class Template Reference

CRTP for leaking singleton. More...

#include <utl/Singleton.h>

Inheritance diagram for utl::LeakingSingleton< T >:
Inheritance graph
[legend]

Static Public Member Functions

static T & GetInstance ()
 

Protected Member Functions

 LeakingSingleton ()
 
 ~LeakingSingleton ()
 

Private Member Functions

 LeakingSingleton (const LeakingSingleton &)
 
LeakingSingletonoperator= (const LeakingSingleton &)
 

Detailed Description

template<class T>
class utl::LeakingSingleton< T >

CRTP for leaking singleton.

This type of creation (Gamma singleton) leaks the object at the end of the run, i.e. class T destructor does not get called in at_exit().

This singleton can be implemented as follows

#include <utl/Singleton.h>
class SomeClass : public utl::LeakingSingleton<SomeClass> {
...
private:
// prevent creation, destruction
SomeClass() { }
~SomeClass() { }
friend class utl::LeakingSingleton<SomeClass>;
};

LeakingSingleton automatically prevents copying of the derived class.

Author
Darko Veberic
Date
9 Aug 2006

Definition at line 124 of file Singleton.h.

Constructor & Destructor Documentation

template<class T>
utl::LeakingSingleton< T >::LeakingSingleton ( )
inlineprotected

Definition at line 136 of file Singleton.h.

template<class T>
utl::LeakingSingleton< T >::~LeakingSingleton ( )
inlineprotected

Definition at line 137 of file Singleton.h.

template<class T>
utl::LeakingSingleton< T >::LeakingSingleton ( const LeakingSingleton< T > &  )
private

Member Function Documentation

template<class T>
static T& utl::LeakingSingleton< T >::GetInstance ( )
inlinestatic

Definition at line 128 of file Singleton.h.

template<class T>
LeakingSingleton& utl::LeakingSingleton< T >::operator= ( const LeakingSingleton< T > &  )
private

The documentation for this class was generated from the following file:

, generated on Tue Sep 26 2023.