| 1447 | // where <digits> are written by f(it). |
| 1448 | template <typename F> |
| 1449 | void write_int(int num_digits, string_view prefix, format_specs specs, F f) { |
| 1450 | std::size_t size = prefix.size() + to_unsigned(num_digits); |
| 1451 | char_type fill = specs.fill[0]; |
| 1452 | std::size_t padding = 0; |
| 1453 | if (specs.align == align::numeric) { |
| 1454 | auto unsiged_width = to_unsigned(specs.width); |
| 1455 | if (unsiged_width > size) { |
| 1456 | padding = unsiged_width - size; |
| 1457 | size = unsiged_width; |
| 1458 | } |
| 1459 | } else if (specs.precision > num_digits) { |
| 1460 | size = prefix.size() + to_unsigned(specs.precision); |
| 1461 | padding = to_unsigned(specs.precision - num_digits); |
| 1462 | fill = static_cast<char_type>('0'); |
| 1463 | } |
| 1464 | if (specs.align == align::none) specs.align = align::right; |
| 1465 | write_padded(specs, padded_int_writer<F>{size, prefix, fill, padding, f}); |
| 1466 | } |
| 1467 | |
| 1468 | // Writes a decimal integer. |
| 1469 | template <typename Int> void write_decimal(Int value) { |