You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The precision is a decimal number indicating how many digits should be displayed after the decimal point for a floating-point value formatted with 'f' and 'F', or before and after the decimal point for a floating-point value formatted with 'g' or 'G'. For non-number types the field indicates the maximum field size - in other words, how many characters will be used from the field content. The precision is not allowed for integer values.
So I tried to use precision on a string argument, for example:
Fixed in 43aebf5. As for "precision" for integer arguments, the fmt::format function follows Python's conventions in not allowing it, but as in Python you can use a combination of fill and width for similar effect:
fmt::format("{:05}", 42); // returns "00042"
or use fmt::sprintf which follows printf conventions and allows precision for integer arguments.
From the docs:
So I tried to use precision on a string argument, for example:
which results in segfault:
Also note that printf allows the precision specifier even for integer arguments:
The text was updated successfully, but these errors were encountered: