Function cras::from_chars(const ::std::string&, double&, const ::std::chars_format)
Defined in File from_chars.hpp
Function Documentation
-
inline ::std::from_chars_result cras::from_chars(const ::std::string &string, double &value, const ::std::chars_format fmt = ::std::chars_format::general) noexcept
Convert the given string to its best double representation. The behavior is similar to std::from_chars(), i.e. no leading space of plus sign is allowed.
- Parameters:
string – [in] The string to convert.
value – [out] The parsed value (valid only if parsing succeeded, i.e.
ecin the result is 0).fmt – [in] Bitmask of
std::chars_formatvalues that specify the format rules with which the value should be interpreted. Not all formats have to be supported.
- Returns:
Struct containing the error code
ec- 0 on success,std::errc::invalid_argumentif no number could be parsed, andstd::errc::result_out_of_rangeif a numeric value was parsed but did not fit into a double. It is implementation specific, whetherresult_out_of_rangeor 0/inf will be returned for too small/large values.ptrpoints to the first character that was not parsed as a part of the numeric value.