Banuba SDK
Toggle main menu visibility
Loading...
Searching...
No Matches
libs
utils
bnb
utils
class_unique_id.hpp
1
#pragma once
2
3
namespace
bnb
4
{
5
/**
6
* @addtogroup Utils
7
* @{
8
*/
9
10
template
<
typename
Class>
11
size_t
class_unique_id()
12
{
13
static
const
char
registrar_slot = 0;
14
return
reinterpret_cast<
size_t
>
(®istrar_slot);
15
}
16
17
template
<
typename
IdType,
typename
T>
18
class
identified_class
19
{
20
public
:
21
static
const
char
* get_name()
noexcept
22
{
23
try
{
24
return
typeid
(T).name();
25
}
catch
(
const
std::bad_typeid&) {
26
return
"unknown"
;
27
}
28
}
29
30
static
IdType get_id()
noexcept
31
{
32
return
static_cast<
IdType
>
(class_unique_id<T>());
33
}
34
};
35
36
/** @} */
// endgroup utils
37
}
// namespace bnb
bnb::identified_class
Definition
class_unique_id.hpp:19
Generated by
1.17.0