GENEIAL
0.2=/
Main Page
Related Pages
Classes
Files
File List
All
Classes
Pages
src
src
lib
geneial
utility
patterns
Singleton.h
1
#pragma once
2
3
template
<
typename
C>
4
class
singleton
5
{
6
public
:
7
static
C* instance()
8
{
9
if
(!_instance)
10
_instance =
new
C();
11
return
_instance;
12
}
13
virtual
~
singleton
()
14
{
15
delete
_instance;
16
_instance = 0;
17
}
18
private
:
19
static
C* _instance;
20
protected
:
21
singleton
()
22
{
23
}
24
};
25
template
<
typename
C> C*
singleton<C>::_instance
= 0;
26
singleton
Definition:
Singleton.h:4
Generated on Mon Feb 27 2017 23:15:19 for GENEIAL by
1.8.6