read_as_json Eigen::Matrix support #2271
elijahfrey
started this conversation in
General
Replies: 0 comments
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.
-
I am a newer programmer and still learning c++ so apologies in advance in any of my terminology is wrong. I am using glaze in a project to parse input files in json format and came across an issue when trying to overwrite elements of an Eigen::Matrix using the read_as_json function. My usage looks something like:
glz::read_as_json(input_struct, "/matrix/0", "1.0")where matrix is a member of the input_struct. This ends up returning a seek error and the value is not overwritten. The issue occurs because when the json_ptr is cut down to "/0" the default implementation of op() in the seek_op struct is called and since json_ptr is not empty an error is returned. I was able to fix the issue by adding:
into seek.hpp. Not sure if this is a bug, feature that has not yet been implemented, or something intentionally left out so I thought I would bring it up in discussions. Additionally, this issue only came up when I used a 2d eigen matrix, when I used eigen vectors no issues occured.
Beta Was this translation helpful? Give feedback.
All reactions