Gaia-ECS
v0.9.3
A simple and powerful entity component system
Loading...
Searching...
No Matches
dyn_singleton.h
1
#pragma once
2
3
namespace
gaia
{
4
namespace
core {
20
template
<
typename
T>
21
class
dyn_singleton
final {
22
T* m_obj =
new
T();
23
24
dyn_singleton
() =
default
;
25
26
public
:
27
static
T& get()
noexcept
{
28
static
dyn_singleton<T>
singleton;
29
return
*singleton.m_obj;
30
}
31
32
dyn_singleton
(
dyn_singleton
&& world) =
delete
;
33
dyn_singleton
(
const
dyn_singleton
& world) =
delete
;
34
dyn_singleton
& operator=(
dyn_singleton
&&) =
delete
;
35
dyn_singleton
& operator=(
const
dyn_singleton
&) =
delete
;
36
37
~dyn_singleton
() {
38
get().done();
39
}
40
};
41
}
// namespace core
42
}
// namespace gaia
gaia::core::dyn_singleton
Gaia-ECS is a header-only library which means we want to avoid using global static variables because ...
Definition
dyn_singleton.h:21
gaia
Checks if endianess was detected correctly at compile-time.
Definition
bitset.h:9
include
gaia
core
dyn_singleton.h
Generated by
1.9.8