libvisual
0.5.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
libvisual
lv_singleton.hpp
1
#ifndef _LV_SINGLETON_HPP
2
#define _LV_SINGLETON_HPP
3
4
namespace
LV {
5
12
template
<
class
T>
13
class
Singleton
14
{
15
public
:
16
17
Singleton
(
Singleton
const
&) =
delete
;
18
19
Singleton
const
& operator= (
Singleton
const
&) =
delete
;
20
22
virtual
~Singleton
() {}
23
27
static
T*
instance
() {
28
return
m_instance;
29
}
30
32
static
void
destroy
()
33
{
34
delete
m_instance;
35
m_instance =
nullptr
;
36
}
37
38
protected
:
39
40
static
T* m_instance;
41
42
Singleton
() =
default
;
43
};
44
45
}
// LV namespace
46
47
#endif // _LV_SINGLETON_HPP