How can I serialize user-defined class Person #460
yuzu-ogura
started this conversation in
General
Replies: 1 comment
-
void write(ryml::NodeRef *n, Person const& val)
{
*n |= ryml::MAP;
(*n)["name"] << val.name;
(*n)["age"] << val.age;
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is my ADT Person:
struct Person
{
int age = 0;
std::string name = "Tom";
};
How to serialize to a map like below by
tree << person;
Beta Was this translation helpful? Give feedback.
All reactions