The older `format()` allows you to print a `+` sign for non-negative
integral numbers upon request.
Examples:
```c++
format("%+d", 255); // -> "+255"
format("%+d", -12); // -> "-12"
```
This change adds the ability to do the same with `formatv()`:
```c++
formatv("{0:+d}", 255); // -> "+255"
formatv("{0:+d}", -12); // -> "-12"
```
The default behaviour is not changed. That means, for a format specifier
like "{0:d}" we still print the positive integer without a "+" prefix.
The special case of "+0" is exactly like it is handled with `format()`:
```c++
format("%+d", 0); // -> "+0"
```
This work is related to #35980.
8.1 KiB
8.1 KiB