mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-02 02:29:08 +00:00
Replace an assert with an exception
This commit is contained in:
parent
21ed92a6e9
commit
eab2ea9fc2
@ -1403,10 +1403,8 @@ inline Int to_nonnegative_int(T value, Int upper) {
|
|||||||
}
|
}
|
||||||
template <typename T, typename Int, FMT_ENABLE_IF(!std::is_integral<T>::value)>
|
template <typename T, typename Int, FMT_ENABLE_IF(!std::is_integral<T>::value)>
|
||||||
inline Int to_nonnegative_int(T value, Int upper) {
|
inline Int to_nonnegative_int(T value, Int upper) {
|
||||||
FMT_ASSERT(
|
if (value < 0 || value > static_cast<T>(upper))
|
||||||
std::isnan(value) || (value >= 0 && value <= static_cast<T>(upper)),
|
throw format_error("invalid value");
|
||||||
"invalid value");
|
|
||||||
(void)upper;
|
|
||||||
return static_cast<Int>(value);
|
return static_cast<Int>(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user