Skyward boardcore
Loading...
Searching...
No Matches
Boardcore::Singleton< T > Class Template Reference

#include <Singleton.h>

Public Member Functions

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

Static Public Member Functions

static T & getInstance ()
 

Protected Member Functions

 Singleton ()
 

Detailed Description

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

WARNING: Deriving from this class is not enough to make a singleton, you also have to declare the constructor of your class private!

class Foo : public Singleton<Foo>
{
friend Singleton<Foo>;
private:
Foo() {} // Ok, private constructor
};

Look here for more info on Singletons: https://stackoverflow.com/questions/1008019/c-singleton-design-pattern

Definition at line 46 of file Singleton.h.

Constructor & Destructor Documentation

◆ Singleton() [1/2]

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

Definition at line 59 of file Singleton.h.

◆ Singleton() [2/2]

template<typename T >
Boardcore::Singleton< T >::Singleton ( const Singleton< T > & )
delete

Member Function Documentation

◆ getInstance()

template<typename T >
static T & Boardcore::Singleton< T >::getInstance ( )
inlinestatic
Returns
A reference to the only instance of the class T.

Definition at line 52 of file Singleton.h.

◆ operator=()

template<typename T >
Singleton & Boardcore::Singleton< T >::operator= ( const Singleton< T > & )
delete

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