| 79 | }; |
| 80 | |
| 81 | struct printf_precision_handler { |
| 82 | template <typename T, FMT_ENABLE_IF(std::is_integral<T>::value)> |
| 83 | auto operator()(T value) -> int { |
| 84 | if (!int_checker<std::numeric_limits<T>::is_signed>::fits_in_int(value)) |
| 85 | throw_format_error("number is too big"); |
| 86 | return (std::max)(static_cast<int>(value), 0); |
| 87 | } |
| 88 | |
| 89 | template <typename T, FMT_ENABLE_IF(!std::is_integral<T>::value)> |
| 90 | auto operator()(T) -> int { |
| 91 | throw_format_error("precision is not integer"); |
| 92 | return 0; |
| 93 | } |
| 94 | }; |
| 95 | |
| 96 | // An argument visitor that returns true iff arg is a zero integer. |
| 97 | struct is_zero_int { |