absl::from_chars_result

The return result of a string-to-number conversion.

Synopsis

Declared in <absl/strings/charconv.h>

struct from_chars_result;

Description

ec will be set to invalid_argument if a well-formed number was not found at the start of the input range, result_out_of_range if a well-formed number was found, but it was out of the representable range of the requested type, or to std::errc() otherwise.

If a well-formed number was found, ptr is set to one past the sequence of characters that were successfully parsed. If none was found, ptr is set to the first argument to from_chars.

Data Members

NameDescription
ec The error code describing the outcome of the conversion.
ptr One past the last character successfully parsed, or first if none.

Non-Member Functions

NameDescription
from_charsWorkalike compatibility version of std::from_chars from C++17 for float.
from_charsWorkalike compatibility version of std::from_chars from C++17. Currently this only supports the double and float types.