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_info.h
Go to the documentation of this file.
#pragma once
#include <
iosfwd
>
#include <
string
>
#include <
string_view
>
#include <
librepr/util/string/buffer.h
>
#include <
librepr/macro/format.h
>
#include <
librepr/name/type.h
>
namespace
librepr
{
template
<
typename
T>
struct
TypeName
{
static
std::string
to_string
()
noexcept
{
return
librepr::get_name<T>
(); }
/* implicit */
operator
std::string
()
const
noexcept
{
// NOLINT
return
to_string
();
}
friend
std::ostream
&
operator<<
(
std::ostream
&
ctx
,
TypeName<T>
const
&
obj
) {
return
ctx
<<
obj
.to_string(); }
friend
detail::StringBuffer
&
operator<<
(
detail::StringBuffer
&
ctx
,
TypeName<T>
const
&
obj
) {
return
ctx
<<
obj
.to_string();
}
friend
detail::StringBuffer
&
operator<<
(
detail::StringBuffer
&
ctx
,
TypeName<T>
const
&
obj
) {
…
};
};
struct
TypeName
{
…
};
}
// namespace librepr
namespace
librepr::detail
{
template
<
class
CharT>
using
StrFormatter
= REPR_FORMAT_NS::formatter<std::string, CharT>;
}
// namespace librepr::detail
// REPR_FORMAT_NS::format support for librepr::TypeName<T>{} and nameof<T>
template
<
class
T,
class
CharT>
struct
REPR_FORMAT_RNS::formatter<
librepr
::TypeName<T>, CharT> :
librepr::detail::StrFormatter
<CharT> {
// NOLINT
auto
format
(
librepr::TypeName<T>
const
& obj,
auto
& ctx)
const
{
return
librepr::detail::StrFormatter<CharT>::format
(obj.
to_string
(), ctx);
}
auto
format
(
librepr::TypeName<T>
const
& obj,
auto
& ctx)
const
{
…
}
};
struct
REPR_FORMAT_RNS::formatter<
librepr
::TypeName<T>, CharT> :
librepr::detail::StrFormatter
<CharT> {
// NOLINT
{
…
};
include
librepr
type_info.h
Generated by
1.9.8, using the excellent
Doxygen Awesome
Theme