xrpld
Loading...
Searching...
No Matches
include
xrpl
beast
type_name.h
1
#pragma once
2
3
#include <
cstdlib
>
4
#include <
string
>
5
#include <
type_traits
>
6
#include <
typeinfo
>
7
8
#ifndef _MSC_VER
9
#include <cxxabi.h>
10
#endif
11
12
namespace
beast
{
13
14
template
<
typename
T>
15
std::string
16
typeName
()
17
{
18
using
TR =
std::remove_reference_t<T>
;
19
20
std::string
name =
typeid
(TR).name();
21
22
#ifndef _MSC_VER
23
if
(
auto
s = abi::__cxa_demangle(name.
c_str
(),
nullptr
,
nullptr
,
nullptr
))
24
{
25
name = s;
26
std::free
(s);
27
}
28
#endif
29
30
if
(
std::is_const_v<TR>
)
31
name +=
" const"
;
32
if
(
std::is_volatile_v<TR>
)
33
name +=
" volatile"
;
34
if
(
std::is_lvalue_reference_v<T>
)
35
{
36
name +=
"&"
;
37
}
38
else
if
(
std::is_rvalue_reference_v<T>
)
39
{
40
name +=
"&&"
;
41
}
42
43
return
name;
44
}
45
46
}
// namespace beast
std::string
std::string::c_str
T c_str(T... args)
cstdlib
std::free
T free(T... args)
std::is_const_v
T is_const_v
std::is_lvalue_reference_v
T is_lvalue_reference_v
std::is_rvalue_reference_v
T is_rvalue_reference_v
std::is_volatile_v
T is_volatile_v
beast
Definition
base_uint.h:673
beast::typeName
std::string typeName()
Definition
type_name.h:16
std::remove_reference_t
string
type_traits
typeinfo
Generated by
1.16.1