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

Can't serialize std::optional in a structure #156

Closed
dsiroky opened this issue Apr 4, 2024 · 2 comments
Closed

Can't serialize std::optional in a structure #156

dsiroky opened this issue Apr 4, 2024 · 2 comments

Comments

@dsiroky
Copy link

dsiroky commented Apr 4, 2024

Hi!
Standalone std::optional can be serialized but once it is in a structure then the structure can't be serialized.
Example: https://godbolt.org/z/1Go4Pqqa4
The error is most likely the same as in #121.
How can I do it properly?
Thanks.

@eyalz800
Copy link
Owner

eyalz800 commented Apr 4, 2024

Please look in the readme that detecting number of members is not always possible - see https://godbolt.org/z/PPvqP8ozY in order to fix this, otherwise we need to wait for P1061 or reflection or some other workaround.

@eyalz800 eyalz800 closed this as completed Apr 4, 2024
@dsiroky
Copy link
Author

dsiroky commented Apr 4, 2024

Thank you! Great library btw.

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

2 participants