Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No way to auto deserialize to a struct from disk #15

Closed
lawmaestro opened this issue Mar 7, 2020 · 1 comment
Closed

No way to auto deserialize to a struct from disk #15

lawmaestro opened this issue Mar 7, 2020 · 1 comment

Comments

@lawmaestro
Copy link

lawmaestro commented Mar 7, 2020

When using visit_struct.hpp to enable auto serialise/deserialise of structs, there's no way to actually deserialise data from disk. If you consider the following:

configuru::Config config = configuru::Config(rawJsonString); configuru::deserialize(&testStruct, config, errorReporter);

It will fail with Failed to deserialize object: config is not an object. - since the instance of configuru::Config was constructed from a raw string. So unless I'm missing something, is it not possible to auto deserialise from a raw string?

@lawmaestro
Copy link
Author

To answer my own question. When writing/reading to/from disk, you need to use the provided dump_file/parse_file functions. Previously I was using config.c_str() to write out the raw string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant