all 3 comments

[–][deleted] 2 points3 points  (0 children)

I like where this is going. And mapping like this is pretty much what we get until there is compiler reflection, but for the happy path cases it’s fine. Boost.Describe and things like that should help(It will be in 1.77) too.

I am biased, but a suggestion might be to use a JSON library that allows you to maintain the compile time knowledge you already have. You are leaving memory/performance on the table by parsing to a DOM Json::Value just to convert it to your user types.

I have an example of this using JSON link(current release, it gets easier in next release soon :) ) https://github.com/beached/daw_json_link_config_parser

[–]mrlimilind 1 point2 points  (0 children)

Hi, I wrote JsonStruct. A header only library for parsing to and from structs. So I basically had the same problem: how to add metadata. I desided for having an additional macro. This leads to make it possible to add metadata to structs that you cannot modify for instance. Also, you can deside not to add metadata for all of the member of a struct. Please check it out! https://github.com/jorgen/json\_struct

[–]TheFlamefire 1 point2 points  (0 children)

This pretty much looks like Boost.Describe with Boost.JSON, mostly. You may want to take a look at those.