Skip to content
Discussion options

You must be logged in to vote

The key thing about deserializing though is that the input string (or blob, ...) tells you what you're deserializing, not the type. For example, if you see a { in the input string, you call ecs_meta_push. If you see a comma, you call ecs_meta_next etc.

If you were to iterate all members of a type in order, you'd require that members always appear in the same order in the input data, which would be brittle.

That said, if you are serializing, it makes a lot of sense to iterate members. See this example for how you can do that:
https://github.com/SanderMertens/flecs/blob/master/examples/cpp/reflection/custom_serializer/src/main.cpp

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by tomwjerry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants