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
repr
Go to the documentation of this file.
#pragma once
#include <
string
>
#include <
librepr/customization.h
>
#include <
librepr/type_info.h
>
#include <
librepr/visit.h
>
#include <
librepr/visitors/repr.h
>
#include <
librepr/visitors/cpp.h
>
#include <
librepr/visitors/python.h
>
#include <
librepr/visitors/layout.h
>
namespace
librepr
{
struct
ReprWrapper
{
template
<
typename
T>
std::string
operator()
(T
const
&
obj
,
Options
options = {})
const
{
// TODO this could be static once msvc supports it
auto
visitor
=
ReprVisitor
{options};
librepr::visit
(
visitor
,
obj
);
return
visitor
.result.extract();
}
std::string
operator()
(T
const
&
obj
,
Options
options = {})
const
{
…
}
};
struct
ReprWrapper
{
…
};
enum class
Language
{
CPP
,
Python
};
template
<
typename
T, Language language = Language::CPP>
std::string
code_for
() {
if
constexpr
(language ==
Language::Python
) {
auto
visitor
=
librepr::PythonVisitor
{};
librepr::visit<T>
(
visitor
);
return
visitor
.result.extract();
}
auto
visitor
=
librepr::CppVisitor
{};
librepr::visit<T>
(
visitor
);
return
visitor
.result.extract();
}
std::string
code_for
() {
…
}
template
<
typename
T>
std::string
layout_of
() {
auto
visitor
=
librepr::LayoutVisitor
();
librepr::visit<T>
(
visitor
);
return
visitor
.result.extract();
}
std::string
layout_of
() {
…
}
}
// namespace librepr
inline
constexpr ::librepr::ReprWrapper
repr
{};
template
<
typename
T>
inline
constexpr ::librepr::TypeName<T>
nameof
{};
include
repr
Generated by
1.9.8, using the excellent
Doxygen Awesome
Theme