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
// NOLINTNEXTLINE(cppcoreguidelines-no-malloc)
27
std::free
(s);
28
}
29
#endif
30
31
if
(
std::is_const_v<TR>
)
32
name +=
" const"
;
33
if
(
std::is_volatile_v<TR>
)
34
name +=
" volatile"
;
35
if
(
std::is_lvalue_reference_v<T>
)
36
{
37
name +=
"&"
;
38
}
39
else
if
(
std::is_rvalue_reference_v<T>
)
40
{
41
name +=
"&&"
;
42
}
43
44
return
name;
45
}
46
47
}
// 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:691
beast::typeName
std::string typeName()
Definition
type_name.h:16
std::remove_reference_t
string
type_traits
typeinfo
Generated by
1.16.1