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

Which native types does get<type>() allow? #1403

Closed
ibc opened this issue Dec 23, 2018 · 2 comments
Closed

Which native types does get<type>() allow? #1403

ibc opened this issue Dec 23, 2018 · 2 comments

Comments

@ibc
Copy link

ibc commented Dec 23, 2018

For example, this seems to work:

uint32_t value = someField.get<uint32_t>();

But I cannot find in the API doc which types can be given as template.

@nlohmann
Copy link
Owner

There is no real documentation so far. For the primitive types (bool, std::string, std::unint64_t, std::int64_t, and double), get executes a static cast and throws if the types are incompatible. For structured types (object, array), we added some more magic to do the translations.

@ibc
Copy link
Author

ibc commented Dec 23, 2018

Ok, if a static cast is done internally then it's clear :)
Thanks.

@ibc ibc closed this as completed Dec 23, 2018
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