Template Function fast_float::from_chars
Defined in File rapidyaml-0.5.0.hpp
Function Documentation
-
template<typename T>
from_chars_result fast_float::from_chars(const char *first, const char *last, T &value, chars_format fmt = chars_format::general) noexcept This function parses the character sequence [first,last) for a number. It parses floating-point numbers expecting a locale-indepent format equivalent to what is used by std::strtod in the default (“C”) locale. The resulting floating-point value is the closest floating-point values (using either float or double), using the “round to even” convention for values that would otherwise fall right in-between two values. That is, we provide exact parsing according to the IEEE standard.
Given a successful parse, the pointer (
ptr
) in the returned value is set to point right after the parsed number, and thevalue
referenced is set to the parsed value. In case of error, the returnedec
contains a representative error, otherwise the default (std::errc()
) value is stored.The implementation does not throw and does not allocate memory (e.g., with
new
ormalloc
).Like the C++17 standard, the
fast_float::from_chars
functions take an optional last argument of the typefast_float::chars_format
. It is a bitset value: we check whetherfmt & fast_float::chars_format::fixed
andfmt & fast_float::chars_format::scientific
are set to determine whether we allowe the fixed point and scientific notation respectively. The default isfast_float::chars_format::general
which allows bothfixed
andscientific
.