mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-27 12:30:06 +00:00
Fix to_nonnegative_int
This commit is contained in:
parent
9234fe83f9
commit
7650ed04a3
@ -1097,9 +1097,10 @@ inline auto to_nonnegative_int(T value, Int upper) -> Int {
|
||||
}
|
||||
template <typename T, typename Int, FMT_ENABLE_IF(!std::is_integral<T>::value)>
|
||||
inline auto to_nonnegative_int(T value, Int upper) -> Int {
|
||||
if (value < 0 || value > static_cast<T>(upper))
|
||||
auto int_value = static_cast<Int>(value);
|
||||
if (int_value < 0 || value > static_cast<T>(upper))
|
||||
FMT_THROW(format_error("invalid value"));
|
||||
return static_cast<Int>(value);
|
||||
return int_value;
|
||||
}
|
||||
|
||||
constexpr auto pow10(std::uint32_t n) -> long long {
|
||||
|
Loading…
Reference in New Issue
Block a user