blob: 432e2ed7f0765b13eab2de8a643599b20be4fa4e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#ifndef _SINGLETON_H_
#define _SINGLETON_H_
template<typename T>
class Singleton
{
public:
static T *GetInstance()
{
if (!instance)
instance = new T;
return instance;
}
private:
static T* instance;
Singleton();
Singleton(Singleton const&);
~Singleton();
Singleton &operator=(Singleton const&);
};
template <typename T> T *Singleton<T>::instance = 0;
#endif //_SINGLETON_H_
|