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

assign intergers to generic-json glz::json_t #1422

Open
alan0526 opened this issue Nov 5, 2024 · 2 comments
Open

assign intergers to generic-json glz::json_t #1422

alan0526 opened this issue Nov 5, 2024 · 2 comments

Comments

@alan0526
Copy link

alan0526 commented Nov 5, 2024

// code of glz::json_t val_t difinition
using val_t = std::variant<null_t, double, std::string, bool, array_t, object_t>;
The val_t type of glz::json_t is a variant and there is not an interger in it.
And the assignment operator json_t& operator=(const intgers value) is also not exist.
So It is not allowed to assign integers to glz::json_t object.

@stephenberry
Copy link
Owner

Thanks for the suggestion. I've been moving towards adding an int64_t to the variant so that we can store either an integer or a double, but doubles can exactly represent most integers, so in the short term converting the integer to a double should be a workable solution. I'll add an assignment operator for integers.

@alan0526
Copy link
Author

alan0526 commented Nov 6, 2024

OK, thanks.

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