scn::scan_error class

Error class. Used as a return value for functions without a success value.

Public types

enum code { good = 0, end_of_range, invalid_format_string, invalid_scanned_value, value_out_of_range, max_error }
Error code.

Constructors, destructors, conversion operators

operator bool() const explicit constexpr noexcept
Evaluated to true if there was no error.
scan_error() defaulted constexpr noexcept
Constructs an error with code::good and no message.
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.

Enum documentation

enum scn::scan_error::code

Error code.

Enumerators
good

No error.

end_of_range

EOF.

invalid_format_string

Format string was invalid.

invalid_scanned_value

Scanned value was invalid for given type. e.g. a period '.' when scanning for an int

value_out_of_range

Scanned value was out of range for the desired type. (e.g. >2^32 for an uint32_t)

max_error