| 35 | }; |
| 36 | |
| 37 | class printf_precision_handler { |
| 38 | public: |
| 39 | template <typename T, FMT_ENABLE_IF(std::is_integral<T>::value)> |
| 40 | int operator()(T value) { |
| 41 | if (!int_checker<std::numeric_limits<T>::is_signed>::fits_in_int(value)) |
| 42 | FMT_THROW(format_error("number is too big")); |
| 43 | return (std::max)(static_cast<int>(value), 0); |
| 44 | } |
| 45 | |
| 46 | template <typename T, FMT_ENABLE_IF(!std::is_integral<T>::value)> |
| 47 | int operator()(T) { |
| 48 | FMT_THROW(format_error("precision is not integer")); |
| 49 | return 0; |
| 50 | } |
| 51 | }; |
| 52 | |
| 53 | // An argument visitor that returns true iff arg is a zero integer. |
| 54 | class is_zero_int { |