scn::scan_error class

Error class. Used as a return value for functions without a success value. Doesn't have a success state, and isn't default constructible: use expected<void, scan_error> to achieve that.

Public types

enum code { end_of_input, invalid_format_string, invalid_scanned_value, invalid_literal, invalid_fill, length_too_short, invalid_source_state, value_positive_overflow, value_negative_overflow, value_positive_underflow, value_negative_underflow, max_error }
Error code.

Constructors, destructors, conversion operators

scan_error(code_t c, const char* m) constexpr noexcept
Constructs an error with c and m

Public functions

auto code() const →  code_t constexpr noexcept
Get error code.
auto msg() const →  const char* constexpr noexcept
Get error message.
auto to_errc() const →  std::errc constexpr noexcept
Convert to a std::errc.

Enum documentation

enum scn::scan_error::code

Error code.

Enumerators
end_of_input

Input ended unexpectedly.

invalid_format_string

Format string was invalid. Often a compile-time error, if supported or enabled.

invalid_scanned_value

Scanned value was invalid for given type, or a value of the given couldn't be scanned.

invalid_literal

Literal character specified in format string not found in source.

invalid_fill

Too many fill characters scanned, field precision (max width) exceeded.

length_too_short

Scanned field width was shorter than what was specified as the minimum field width.

invalid_source_state

Source range is in an invalid state, failed to continue reading.

value_positive_overflow

Value out of range, too large (higher than the maximum value) i.e. >2^32 for int32

value_negative_overflow

Value out of range, too small (lower than the minimum value) i.e. <2^32 for int32

value_positive_underflow

Value out of range, magnitude too small, sign + (between 0 and the smallest subnormal float)

value_negative_underflow

Value out of range, magnitude too small, sign - (between 0 and the smallest subnormal float)

max_error