Turning a field into a subdocument using TypeHandler<> #41
bradsgreen
started this conversation in
Show and tell
Replies: 1 comment
-
Ah! Nice. Yeah, so you keep the declarative serialisation and deserialisation, but with support for immutable objects. Maybe there is a way to serialize and deserialize into a std::tuple and then pass all the members of the tuple to a constructor based on the order the metadata is defined in... Ie. we could have something like a JS_OBJ_IMMUTABLE or something, and it would use a tuple typehandler based on the metadata registered, and then pass it to a constructor like you do here... Anyway, nice example! |
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I puzzled for a bit how to turn a complex object of mine, Price, which contains both a value and a currency type. It isn't an open struct so using the JS_OBJ() macro isn't possible. I discovered this solution which might be worth adding to an example for future consumers like me:
(simplified from my actual code)
Beta Was this translation helpful? Give feedback.
All reactions