number_precision
Enumeration of number parsing modes.
Synopsis
Defined in header <boost/json/parse_options.hpp>.
enum class number_precision
: unsigned char;
Values
Name | Description |
---|---|
|
Fast, but potentially less precise mode. |
|
Slower, but precise mode. |
|
The fastest mode, that only validates encountered numbers without parsing them. |
Description
These values are used to select the way to parse numbers. The default mode used by parsing functions is imprecise
. It has the precision not less than 15 decimal places (the number required for IEEE double
). This is also the number guaranteed by functions in most C++ standard library implementations.
But those functions often give a more precise result for certain numbers. For cases where such extra precision is needed the library provides precise
mode. That extra precision comes with a performance cost, though.
Finally, users might want a to parse numbers with an external function when they implement a custom handler for basic_parser
. Since it is wasteful to parse a number only to throw the result away, the library provides a mode to not parse numbers at all. Note: the library still have to validate that the input is a number, in order to catch syntax errors and to know when the number ends.
See Also
Convenience header <boost/json.hpp>.