Closed gurbaaz27 closed 2 years ago
No, this doesn't exist currently. Yes, this will probably be added soon. It's really simple to add some convenience macros and prevents quite a bit of duplication.
Shorthand macros have been added. Thanks for raising this issue.
Documentation has been added to the readme. Here's the example:
In order to use these macros you must include the header: glaze/core/macros.hpp
struct macro_t {
double x = 5.0;
std::string y = "yay!";
int z = 55;
};
GLZ_META(macro_t, x, y, z);
struct local_macro_t {
double x = 5.0;
std::string y = "yay!";
int z = 55;
GLZ_LOCAL_META(local_macro_t, x, y, z);
};
Hi! I wanted to know if glaze has some shorthand way to serialize/deserialize a json to/from struct, like the one nlohmann json provides with
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE
andNLOHMANN_DEFINE_TYPE_INTRUSIVE
macros. To quote their solution,If not yet, are there any plans to implement a similar or better thing? Since otherwise basic serialization/deserialization of deeply nested structs become a big pain.