3 ms·
Could this be leveraged to emit a parser that is specialized for the provided type that can be used at runtime? Afaik .NET does something like that using code g
by nikeee 2y ago
Could this be leveraged to emit a parser that is specialized for the provided type that can be used at runtime? Afaik .NET does something like that using code generators.
The advantage being that the parser is tailored to the specific type that is deserialized and it writes directly to the struct's fields instead of going through some dictionary.
- leni536 2y agoThis lib does something like that: https://github.com/beached/daw_json_link https://github.com/beached/daw_json_link
- nikeee 2y agoIt seems that you have to maintain hand-coded mappings for each type. Maybe this could be solved by using C++23's compile-time reflections.
- dctwin 2y agoYes, the nonconstexpr version does just that, unless I misunderstood your question. See also boost::spirit for a 'big' version of this