mp_units::utility::parse_nonnegative_int

Parses the range [begin, end) as an unsigned integer.]

Synopsis

Declared in <mp-units/utility/format.h>

template<std::forward_iterator It>
[[nodiscard]]
constexpr
int
parse_nonnegative_int(
    It& begin,
    It end,
    int error_value);

Description

The range must be non-empty and start with a digit.

Return Value

the parsed integer, or error_value on overflow

NOTE

The return value should not be discarded.

Parameters

NameDescription
beginthe beginning of the range to parse; advanced past the parsed digits
endthe end of the range to parse
error_valuethe value to return if the parsed integer overflows int