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

SAX API uses unsigned std::size_t but -1 if element size is not known; #2037

Closed
steven-varga opened this issue Apr 13, 2020 · 2 comments
Closed

Comments

@steven-varga
Copy link

In the SAX API std::size_t defines the size, however in the documentation -1 a different type signals unknown size. Did I overlook something?

@nlohmann
Copy link
Owner

What is the exact question? Indeed, if the size is known during parsing, a size can be passed to the start_array() or start_object() functions. If it is unknown, std::size_t(-1) is passed (just similar to std::basic_string::npos.

@steven-varga
Copy link
Author

Thanks for explaining. I was not aware of this technique and was surprised to see an unexpected high value with std::size_t when took your library for a test run. Sorry for the noise!

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

No branches or pull requests

2 participants