repr
0.1
Reconstructable string representations and more
Loading...
Searching...
No Matches
simple.cpp
Simple Example
Simple example showcasing type and value serialization.
//* c++ gsnapshot -std=c++20 -O3
#include <
repr
>
#include <
variant
>
#include <
unordered_map
>
#include <
iostream
>
struct
CustomType {
char
foo;
unsigned
bar;
std::variant<char, bool>
oof;
std::unordered_map<int, int>
zoinks;
};
int
main() {
auto
object
= CustomType{
'f'
, 42U,
true
, {{1, 2}, {3, 4}}};
std::cout
<<
"Object: "
<<
repr
(
object
) <<
'\n'
;
std::cout
<<
"Type: "
<<
librepr::code_for<CustomType>
();
}
std::cout
iostream
librepr::code_for
std::string code_for()
Definition
repr:39
repr
repr
constexpr ::librepr::ReprWrapper repr
Definition
repr:59
unordered_map
variant
Generated by
1.9.8, using the excellent
Doxygen Awesome
Theme