diff --git a/source/utilities.tex b/source/utilities.tex index 9afb80543f..fc9d75c25b 100644 --- a/source/utilities.tex +++ b/source/utilities.tex @@ -19682,7 +19682,7 @@ \begin{ncbnf} \fmtnontermdef{std-format-spec}\br - \opt{fill-and-align} \opt{sign} \opt{\terminal{\#}} \opt{\terminal{0}} \opt{width} \opt{precision} \opt{type} + \opt{fill-and-align} \opt{sign} \opt{\terminal{\#}} \opt{\terminal{0}} \opt{width} \opt{precision} \opt{\terminal{L}} \opt{type} \end{ncbnf} \begin{ncbnf} @@ -19719,7 +19719,7 @@ \begin{ncbnf} \fmtnontermdef{type} \textnormal{one of}\br - \terminal{a A b B c d e E f F g G n o p s x X} + \terminal{a A b B c d e E f F g G o p s x X} \end{ncbnf} \pnum @@ -19880,6 +19880,29 @@ For floating-point types this field specifies the formatting precision. For string types it specifies how many characters will be used from the string. +\pnum +When the \tcode{L} option is used, the form used for the conversion is called +the \defnx{locale-specific form}{locale-specific form!format string}. +The \tcode{L} option is only valid for arithmetic types, and +its effect depends upon the type. +\begin{itemize} +\item +For integral types, the locale-specific form +causes the context's locale to be used +to insert the appropriate digit group separator characters. + +\item +For floating-point types, the locale-specific form +causes the context's locale to be used +to insert the appropriate digit group and radix separator characters. + +\item +For the textual representation of \tcode{bool}, the locale-specific form +causes the context's locale to be used +to insert the appropriate string as if obtained +with \tcode{numpunct::truename} or \tcode{numpunct::falsename}. +\end{itemize} + \pnum The \fmtgrammarterm{type} determines how the data should be presented. @@ -19919,7 +19942,7 @@ string s0 = format("{}", 42); // value of \tcode{s0} is \tcode{"42"} string s1 = format("{0:b} {0:d} {0:o} {0:x}", 42); // value of \tcode{s1} is \tcode{"101010 42 52 2a"} string s2 = format("{0:#x} {0:#X}", 42); // value of \tcode{s2} is \tcode{"0x2a 0X2A"} -string s3 = format("{:n}", 1234); // value of \tcode{s3} might be \tcode{"1,234"} +string s3 = format("{:L}", 1234); // value of \tcode{s3} might be \tcode{"1,234"} // (depending on the locale) \end{codeblock} \end{example} @@ -19968,12 +19991,6 @@ the base prefix is \tcode{0X}. \\ \rowsep % -\tcode{n} & -The same as \tcode{d}, except that -it uses the context's locale -to insert the appropriate digit group separator characters. -\\ \rowsep -% none & The same as \tcode{d}. \begin{note} @@ -19993,7 +20010,7 @@ Copies the character to the output. \\ \rowsep % -\tcode{b}, \tcode{B}, \tcode{d}, \tcode{o}, \tcode{x}, \tcode{X}, \tcode{n} & +\tcode{b}, \tcode{B}, \tcode{d}, \tcode{o}, \tcode{x}, \tcode{X} & As specified in \tref{format.type.int}. \\ \end{floattable} @@ -20009,7 +20026,7 @@ Copies textual representation, either \tcode{true} or \tcode{false}, to the output. \\ \rowsep % -\tcode{b}, \tcode{B}, \tcode{c}, \tcode{d}, \tcode{o}, \tcode{x}, \tcode{X}, \tcode{n} & +\tcode{b}, \tcode{B}, \tcode{c}, \tcode{d}, \tcode{o}, \tcode{x}, \tcode{X} & As specified in \tref{format.type.int} for the value \tcode{static_cast(value)}. @@ -20087,12 +20104,6 @@ it uses \tcode{E} to indicate exponent. \\ \rowsep % -\tcode{n} & -The same as \tcode{g}, except that -it uses the context's locale to insert the appropriate -digit group and decimal radix separator characters. -\\ \rowsep -% none & If \fmtgrammarterm{precision} is specified, equivalent to \begin{codeblock}