mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-25 15:21:54 +00:00
Fix a warning and is_negative usage
This commit is contained in:
parent
6bcc3fd216
commit
f9ceefb0fe
@ -126,11 +126,11 @@ template <> struct std::formatter<S> {
|
|||||||
if constexpr (!is_integral_v<decltype(value)>)
|
if constexpr (!is_integral_v<decltype(value)>)
|
||||||
throw format_error("width is not integral");
|
throw format_error("width is not integral");
|
||||||
// else if (value < 0 || value > numeric_limits<int>::max())
|
// else if (value < 0 || value > numeric_limits<int>::max())
|
||||||
else if (fmt::internal::is_negative(value) < 0 ||
|
else if (fmt::internal::is_negative(value) ||
|
||||||
value > numeric_limits<int>::max())
|
value > numeric_limits<int>::max())
|
||||||
throw format_error("invalid width");
|
throw format_error("invalid width");
|
||||||
else
|
else
|
||||||
return value;
|
return static_cast<int>(value);
|
||||||
},
|
},
|
||||||
ctx.arg(width_arg_id));
|
ctx.arg(width_arg_id));
|
||||||
return format_to(ctx.out(), "{0:{1}}", s.value, width);
|
return format_to(ctx.out(), "{0:{1}}", s.value, width);
|
||||||
|
Loading…
Reference in New Issue
Block a user