Replies: 1 comment 1 reply
-
Can https://json.nlohmann.me/features/arbitrary_types/#how-can-i-use-get-for-non-default-constructiblenon-copyable-types help you? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Because I want to initialize objects with constant members from json, it would be nice if there was such a mechanism. I think it could work somewhat like this:
and then it can be used like this:
Would that be possible or does it clash with some other mechanism or policy or is generally a bad idea for some reason?
The thing is, I have been creating and using make_from_json for some custom types already but without the get specialization in the library, I can't combine that with standard containers, for instance creating std::vector from a json object. Or I have to implement make_from_json for all the container types I use.
Beta Was this translation helpful? Give feedback.
All reactions