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

Curiously Recurring Template Pattern (CRTP) for Meyers singleton. More...

#include <utl/Singleton.h>

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

Public Attributes

static T &return instance
 

Protected Member Functions

 Singleton ()
 
 ~Singleton ()
 

Private Member Functions

Singletonoperator= (const Singleton &)
 
 Singleton (const Singleton &)
 

Detailed Description

template<typename T>
class utl::Singleton< T >

Curiously Recurring Template Pattern (CRTP) for Meyers singleton.

The singleton class is implemented as follows

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

Singleton automatically prevents copying of the derived class.

Author
Darko Veberic
Date
9 Aug 2006

Definition at line 36 of file Singleton.h.

Constructor & Destructor Documentation

template<typename T>
utl::Singleton< T >::Singleton ( )
inlineprotected

Definition at line 52 of file Singleton.h.

template<typename T>
utl::Singleton< T >::~Singleton ( )
inlineprotected

Definition at line 53 of file Singleton.h.

template<typename T>
utl::Singleton< T >::Singleton ( const Singleton< T > &  )
private

Member Function Documentation

template<typename T>
Singleton& utl::Singleton< T >::operator= ( const Singleton< T > &  )
private

Member Data Documentation

template<typename T>
T& return utl::Singleton< T >::instance
Initial value:
{
static T instance

Definition at line 44 of file Singleton.h.


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

, generated on Tue Sep 26 2023.