repr
0.1
Reconstructable string representations and more
Toggle main menu visibility
Main Page
Installation
Usage
Customization
Extending
FAQ
CI Results
Test
Benchmark
API Documentation
Namespace List
Namespace List
Namespace Members
All
_
a
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
v
w
Functions
_
a
c
d
e
f
g
i
l
m
n
o
r
s
t
u
v
w
Variables
Typedefs
Enumerations
Concept List
Class List
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
~
Functions
_
a
c
e
f
g
i
l
m
n
o
p
r
s
t
v
w
~
Variables
a
b
c
d
e
f
g
i
k
l
m
n
o
p
q
r
s
t
u
v
Typedefs
a
c
d
e
f
g
h
l
m
p
r
s
t
u
v
w
Enumerations
Enumerator
Related Symbols
File List
File List
File Members
All
_
l
n
o
r
u
Variables
Macros
_
l
o
r
u
Examples
Source Code
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
Concepts
Loading...
Searching...
No Matches
type.h
Go to the documentation of this file.
#pragma once
#include <
cstddef
>
#include <
sstream
>
#include <
string
>
#include <
string_view
>
#include <
type_traits
>
#include <
typeinfo
>
#include <
utility
>
#include <
librepr/macro/format.h
>
#include <
librepr/macro/default.h
>
#include <
librepr/util/collections/list.h
>
#include "
ctti.h
"
#include "
rtti.h
"
namespace
librepr
{
template
<
typename
T>
std::string
get_name
();
namespace
detail {
template
<
typename
T>
struct
TemplateInfo
{
static
std::string
name
() {
return
librepr::get_name_raw<T>
(); }
constexpr
static
bool
is_templated
=
false
;
};
struct
TemplateInfo
{
…
};
template
<
template
<
typename
...>
typename
U
,
typename
...
Ts
>
struct
TemplateInfo
<
U
<
Ts
...>> {
using
type
=
U
<
Ts
...>;
using
arguments
=
TypeList
<
Ts
...>;
constexpr
static
bool
is_templated
=
true
;
private
:
template
<
std::size_t
...
Idx
>
consteval
static
auto
get_min_required(
std::index_sequence<Idx...>
seq
) ->
std::size_t
{
if
constexpr
(
requires
{
typename
U<typename arguments::template get<Idx>
...>;
// pack::rebox<arguments::head<Idx>, U>
requires
std::is_same_v
<
U
<
Ts
...>,
U<typename arguments::template get<Idx>
...>>;
}) {
if
constexpr
(
sizeof
...(Idx) == 0) {
return
0;
}
else
{
return
get_min_required(
std::make_index_sequence
<
seq
.size() - 1>());
}
}
return
seq
.size() + 1;
}
constexpr
static
auto
required_amount = get_min_required(
std::make_index_sequence
<
sizeof
...(
Ts
)>());
public
:
using
required
=
typename
arguments::template
head<required_amount>
;
using
defaulted
=
typename
arguments::template
tail<required_amount>
;
static
std::string
name
() {
auto
full
=
librepr::get_name_raw<type>
();
auto
marker
=
full
.find(
'<'
);
if
(
marker
==
full
.npos) {
return
full
;
}
return
REPR_FORMAT
(
"{}<{}>"
,
std::string_view
(
full
.data(),
marker
), format_template_arguments());
}
static
std::string
name
() {
…
}
static
std::string
format_template_arguments
() {
constexpr
static
auto
argument_count
=
USING
(
REPR_DEFAULT_TEMPLATE_ARGUMENTS
) ?
sizeof
...(Ts) : required_amount;
return
[]<
std::size_t
...
Idx
>(
std::index_sequence
<
Idx
...>) {
const
char
*
sep
=
""
;
std::ostringstream
out;
(((
out << sep << TemplateInfo<typename arguments::template get<Idx>
>
::name
()),
sep
=
", "
), ...);
return
out.str();
}(
std::make_index_sequence<argument_count>
());
}
static
std::string
format_template_arguments
() {
…
}
};
struct
TemplateInfo
<
U
<
Ts
...>> {
…
};
}
// namespace detail
template
<
typename
T>
char
const
*
get_mangled_name
() {
#if USING(LIBREPR_COMPILER_MSVC)
return
typeid
(T).
raw_name
();
#else
return
typeid
(T).name();
#endif
}
char
const
*
get_mangled_name
() {
…
}
template
<
typename
T>
std::string
get_name
() {
return
librepr::detail::TemplateInfo<std::remove_cvref_t<T>
>::name();
}
std::string
get_name
() {
…
}
}
// namespace librepr
include
librepr
name
type.h
Generated by
1.9.8, using the excellent
Doxygen Awesome
Theme