| 264 | }; |
| 265 | |
| 266 | class PrecisionHandler : |
| 267 | public fmt::internal::ArgVisitor<PrecisionHandler, int> { |
| 268 | public: |
| 269 | unsigned visit_unhandled_arg() { |
| 270 | FMT_THROW(fmt::FormatError("precision is not integer")); |
| 271 | return 0; |
| 272 | } |
| 273 | |
| 274 | template <typename T> |
| 275 | int visit_any_int(T value) { |
| 276 | if (!IntChecker<std::numeric_limits<T>::is_signed>::fits_in_int(value)) |
| 277 | FMT_THROW(fmt::FormatError("number is too big")); |
| 278 | return static_cast<int>(value); |
| 279 | } |
| 280 | }; |
| 281 | |
| 282 | // Converts an integer argument to an integral type T for printf. |
| 283 | template <typename T> |