Skip to content

Syntax error when extending glz::json_t with glm types #1333

Closed Answered by stephenberry
exdal asked this question in Q&A
Discussion options

You must be logged in to vote

The parsing is failing there because the variant isn't auto-deducible and thus defaults to null_t and tries to parse into this null_t, which is why it is erroring in the specialization for always_null_t.

You're correct that your meta for glm::vec2 is conflicting with object_t, since both are objects (meta<glm::vec2>: object(&T::x, &T::y);).

The easiest solution is probably to just use glz::json_t and then you can call if (value.contains("x") && value.contains("y")) this should indicate that you have a glm::vec2. There is an active issue open to support reading a glz::json_t value into a concrete C++ struct here. This would be useful for you as well. Currently you would have to write the v…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@exdal
Comment options

Answer selected by exdal
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