json
json copied to clipboard
[serializer] Added handling for NaN & Inf.
Closes #397
Exposition (the .qbk files) needs to be updated explaining serialization error handling and format conversion of nan/inf
The approach we described in the issue is somewhat different:
- Serializer options are empty by default (not nulls).
- If an option is empty and the corresponding special value is encountered — an error is produced.
- Thus, users should be able to use options and error codes together. If an error_code isn't used, the serializer throws.
Top level APIs for serialzer should probably look like this:
serializer::serializer(serializer_options const& = {});
serializer::read(char* dest, std::size_t size, serializer_options const& = {});
serializer::read(char* dest, std::size_t size, error_code& ec, serializer_options const& = {});
serializer::read(char* dest, std::size_t size, std::error_code& ec, serializer_options const& = {}); // for convenience
Top level APIs for serialzer should probably look like this:
Well no, the serializer should be constructed with the options, they should not be per-read. Alternatively there can be a set_options
function. But it should be specified that undefined behavior results if the options are changed in the middle of serialization.
Benchmark test results. More info at https://benchmark.cppalliance.org/jsonbenchmarks-pullrequests/675/pullrequest.html
Superceded by #884