SUNphi  1.0
SUNphi::SingleInstance< T > Class Template Reference

#include <SingleInstance.hpp>

Public Member Functions

 SingleInstance ()
 Constructor, checking no instance exists before.
 
 ~SingleInstance ()
 Destructor, checking that no instance exists at the end.
 

Private Member Functions

void crashIfInstancesExists ()
 Check that no instance exists.
 

Static Private Member Functions

static int & count ()
 

Detailed Description

template<typename T>
class SUNphi::SingleInstance< T >

Single Instance enforcer class

To enforce a class to be instantiated at most once, inherit this class. Example:

class A :
public SingleInstance<A>
{
};
A a1; // ok
A a2; // error!

Definition at line 29 of file SingleInstance.hpp.

Member Function Documentation

template<typename T>
static int& SUNphi::SingleInstance< T >::count ( )
inlinestaticprivate

Counter of instances

Internal storage

Definition at line 32 of file SingleInstance.hpp.


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