From Jason Turner

[format.string]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp5sxeuffy/{from.md → to.md} +140 -99
tmp/tmp5sxeuffy/{from.md → to.md} RENAMED
@@ -81,13 +81,13 @@ manual indexing. — *end note*]
81
 
82
  ``` cpp
83
  string s0 = format("{} to {}", "a", "b"); // OK, automatic indexing
84
  string s1 = format("{1} to {0}", "a", "b"); // OK, manual indexing
85
  string s2 = format("{0} to {}", "a", "b"); // not a format string (mixing automatic and manual indexing),
86
- // throws format_error
87
  string s3 = format("{} to {1}", "a", "b"); // not a format string (mixing automatic and manual indexing),
88
- // throws format_error
89
  ```
90
 
91
  — *end example*]
92
 
93
  The *format-spec* field contains *format specifications* that define how
@@ -109,17 +109,17 @@ by *arg-id*, the string is not a format string for `args`.
109
 
110
  — *end example*]
111
 
112
  #### Standard format specifiers <a id="format.string.std">[[format.string.std]]</a>
113
 
114
- Each `formatter` specializations described in [[format.formatter.spec]]
115
  for fundamental and string types interprets *format-spec* as a
116
  *std-format-spec*.
117
 
118
  [*Note 1*: The format specification can be used to specify such details
119
- as field width, alignment, padding, and decimal precision. Some of the
120
- formatting options are only supported for arithmetic
121
  types. — *end note*]
122
 
123
  The syntax of format specifications is as follows:
124
 
125
  ``` bnf
@@ -159,21 +159,40 @@ precision
159
  '.' '{' arg-idₒₚₜ '}'
160
  ```
161
 
162
  ``` bnf
163
  type one of
164
- 'a A b B c d e E f F g G o p s x X'
165
  ```
166
 
167
- [*Note 2*: The *fill* character can be any character other than `{` or
168
- `}`. The presence of a fill character is signaled by the character
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
  following it, which must be one of the alignment options. If the second
170
  character of *std-format-spec* is not a valid alignment option, then it
171
- is assumed that both the fill character and the alignment option are
172
  absent. — *end note*]
173
 
174
- The *align* specifier applies to all argument types. The meaning of the
175
  various alignment options is as specified in [[format.align]].
176
 
177
  [*Example 1*:
178
 
179
  ``` cpp
@@ -183,34 +202,49 @@ string s1 = format("{:6}", 'x'); // value of s1 is "x\ \ \ \ \ "
183
  string s2 = format("{:*<6}", 'x'); // value of s2 is "x*****"
184
  string s3 = format("{:*>6}", 'x'); // value of s3 is "*****x"
185
  string s4 = format("{:*^6}", 'x'); // value of s4 is "**x***"
186
  string s5 = format("{:6d}", c); // value of s5 is "\ \ \ 120"
187
  string s6 = format("{:6}", true); // value of s6 is "true\ \ "
 
 
 
 
188
  ```
189
 
190
  — *end example*]
191
 
192
- [*Note 3*: Unless a minimum field width is defined, the field width is
193
- determined by the size of the content and the alignment option has no
194
- effect. *end note*]
 
 
 
 
 
 
195
 
196
  **Table: Meaning of align options** <a id="format.align">[format.align]</a>
197
 
198
  | Option | Meaning |
199
- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
200
- | `<` | Forces the field to be aligned to the start of the available space. This is the default for non-arithmetic types, `charT`, and `bool`, unless an integer presentation type is specified. |
201
- | % `>` | Forces the field to be aligned to the end of the available space. This is the default for arithmetic types other than `charT` and `bool` or when an integer presentation type is specified. |
202
- | % `^` | Forces the field to be centered within the available space by inserting $\bigl\lfloor \frac{n}{2} \bigr\rfloor$ characters before and $\bigl\lceil \frac{n}{2} \bigr\rceil$ characters after the value, where $n$ is the total number of fill characters to insert. |
203
 
204
 
205
  The *sign* option is only valid for arithmetic types other than `charT`
206
  and `bool` or when an integer presentation type is specified. The
207
  meaning of the various options is as specified in [[format.sign]].
208
 
209
- [*Note 4*: For negative numbers and negative zero the output of
210
- `to_chars` will already contain the sign so no additional transformation
211
- is performed. — *end note*]
 
 
 
 
 
212
 
213
  The *sign* option applies to floating-point infinity and NaN.
214
 
215
  [*Example 2*:
216
 
@@ -236,88 +270,82 @@ form causes the result of the conversion of finite values to always
236
  contain a decimal-point character, even if no digits follow it.
237
  Normally, a decimal-point character appears in the result of these
238
  conversions only if a digit follows it. In addition, for `g` and `G`
239
  conversions, trailing zeros are not removed from the result.
240
 
241
- If `{ \opt{arg-id} }` is used in a *width* or *precision*, the value of
242
- the corresponding formatting argument is used in its place. If the
243
- corresponding formatting argument is not of integral type, or its value
244
- is negative for *precision* or non-positive for *width*, an exception of
245
- type `format_error` is thrown.
246
-
247
- The *positive-integer* in *width* is a decimal integer defining the
248
- minimum field width. If *width* is not specified, there is no minimum
249
- field width, and the field width is determined based on the content of
250
- the field.
251
-
252
- The *width* of a string is defined as the estimated number of column
253
- positions appropriate for displaying it in a terminal.
254
-
255
- [*Note 5*: This is similar to the semantics of the POSIX `wcswidth`
256
- function. — *end note*]
257
-
258
- For the purposes of width computation, a string is assumed to be in a
259
- locale-independent, implementation-defined encoding. Implementations
260
- should use a Unicode encoding on platforms capable of displaying Unicode
261
- text in a terminal.
262
-
263
- [*Note 6*: This is the case for Windows-based and many POSIX-based
264
- operating systems. — *end note*]
265
-
266
- For a string in a Unicode encoding, implementations should estimate the
267
- width of a string as the sum of estimated widths of the first code
268
- points in its extended grapheme clusters. The extended grapheme clusters
269
- of a string are defined by UAX \#29. The estimated width of the
270
- following code points is 2:
271
-
272
- - `U+1100-U+115F`
273
- - `U+2329-U+232A`
274
- - `U+2E80-U+303E`
275
- - `U+3040-U+A4CF`
276
- - `U+AC00-U+D7A3`
277
- - `U+F900-U+FAFF`
278
- - `U+FE10-U+FE19`
279
- - `U+FE30-U+FE6F`
280
- - `U+FF00-U+FF60`
281
- - `U+FFE0-U+FFE6`
282
- - `U+1F300-U+1F64F`
283
- - `U+1F900-U+1F9FF`
284
- - `U+20000-U+2FFFD`
285
- - `U+30000-U+3FFFD`
286
-
287
- The estimated width of other code points is 1.
288
-
289
- For a string in a non-Unicode encoding, the width of a string is
290
- unspecified.
291
-
292
- A zero (`0`) character preceding the *width* field pads the field with
293
- leading zeros (following any indication of sign or base) to the field
294
- width, except when applied to an infinity or NaN. This option is only
295
- valid for arithmetic types other than `charT` and `bool` or when an
296
- integer presentation type is specified. If the `0` character and an
297
- *align* option both appear, the `0` character is ignored.
298
 
299
  [*Example 3*:
300
 
301
  ``` cpp
302
  char c = 120;
303
  string s1 = format("{:+06d}", c); // value of s1 is "+00120"
304
  string s2 = format("{:#06x}", 0xa); // value of s2 is "0x000a"
305
- string s3 = format("{:<06}", -42); // value of s3 is "-42\ \ \ " (0 is ignored because of < alignment)
 
306
  ```
307
 
308
  — *end example*]
309
 
310
- The *nonnegative-integer* in *precision* is a decimal integer defining
311
- the precision or maximum field size. It can only be used with
312
- floating-point and string types. For floating-point types this field
313
- specifies the formatting precision. For string types, this field
314
- provides an upper bound for the estimated width of the prefix of the
315
- input string that is copied into the output. For a string in a Unicode
316
- encoding, the formatter copies to the output the longest prefix of whole
317
- extended grapheme clusters whose estimated width is no greater than the
318
- precision.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
319
 
320
  When the `L` option is used, the form used for the conversion is called
321
  the *locale-specific form*. The `L` option is only valid for arithmetic
322
  types, and its effect depends upon the type.
323
 
@@ -338,22 +366,23 @@ The available string presentation types are specified in
338
  [[format.type.string]].
339
 
340
  **Table: Meaning of type options for strings** <a id="format.type.string">[format.type.string]</a>
341
 
342
  | Type | Meaning |
343
- | --------- | -------------------------------- |
344
  | none, `s` | Copies the string to the output. |
 
345
 
346
 
347
  The meaning of some non-string presentation types is defined in terms of
348
  a call to `to_chars`. In such cases, let \[`first`, `last`) be a range
349
  large enough to hold the `to_chars` output and `value` be the formatting
350
  argument value. Formatting is done as if by calling `to_chars` as
351
  specified and copying the output through the output iterator of the
352
  format context.
353
 
354
- [*Note 7*: Additional padding and adjustments are performed prior to
355
  copying the output through the output iterator as specified by the
356
  format specifiers. — *end note*]
357
 
358
  The available integer presentation types for integral types other than
359
  `bool` and `charT` are specified in [[format.type.int]].
@@ -362,49 +391,61 @@ The available integer presentation types for integral types other than
362
 
363
  ``` cpp
364
  string s0 = format("{}", 42); // value of s0 is "42"
365
  string s1 = format("{0:b} {0:d} {0:o} {0:x}", 42); // value of s1 is "101010 42 52 2a"
366
  string s2 = format("{0:#x} {0:#X}", 42); // value of s2 is "0x2a 0X2A"
367
- string s3 = format("{:L}", 1234); // value of s3 might be "1,234"
368
  // (depending on the locale)
369
  ```
370
 
371
  — *end example*]
372
 
373
- [*Note 8*: If the formatting argument type is `charT` or `bool`, the
374
- default is instead `c` or `s`, respectively. — *end note*]
 
 
 
 
 
 
 
 
 
 
 
375
 
376
  The available `charT` presentation types are specified in
377
  [[format.type.char]].
378
 
379
  **Table: Meaning of type options for `charT`** <a id="format.type.char">[format.type.char]</a>
380
 
381
  | Type | Meaning |
382
- | ------------------------------ | ------------------------------------ |
383
  | none, `c` | Copies the character to the output. |
384
  | % `b`, `B`, `d`, `o`, `x`, `X` | As specified in [[format.type.int]]. |
 
385
 
386
 
387
  The available `bool` presentation types are specified in
388
  [[format.type.bool]].
389
 
390
  **Table: Meaning of type options for `bool`** <a id="format.type.bool">[format.type.bool]</a>
391
 
392
  | Type | Meaning |
393
- | ----------------------------------- | -------------------------------------------------------------------------------------- |
394
  | none, `s` | Copies textual representation, either `true` or `false`, to the output. |
395
- | % `b`, `B`, `c`, `d`, `o`, `x`, `X` | As specified in [[format.type.int]] for the value `static_cast<unsigned char>(value)`. |
396
 
397
 
398
  The available floating-point presentation types and their meanings for
399
  values other than infinity and NaN are specified in
400
  [[format.type.float]]. For lower-case presentation types, infinity and
401
  NaN are formatted as `inf` and `nan`, respectively. For upper-case
402
  presentation types, infinity and NaN are formatted as `INF` and `NAN`,
403
  respectively.
404
 
405
- [*Note 9*: In either case, a sign is included if indicated by the
406
  *sign* option. — *end note*]
407
 
408
  **Table: Meaning of type options for floating-point types** <a id="format.type.float">[format.type.float]</a>
409
 
410
  | Type | Meaning |
@@ -420,15 +461,15 @@ respectively.
420
 
421
 
422
  The available pointer presentation types and their mapping to `to_chars`
423
  are specified in [[format.type.ptr]].
424
 
425
- [*Note 10*: Pointer presentation types also apply to
426
  `nullptr_t`. — *end note*]
427
 
428
  **Table: Meaning of type options for pointer types** <a id="format.type.ptr">[format.type.ptr]</a>
429
 
430
  | Type | Meaning |
431
- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
432
- | none, `p` | If `uintptr_t` is defined, \begin{codeblock} to_chars(first, last, reinterpret_cast<uintptr_t>(value), 16) \end{codeblock} with the prefix `0x` added to the output; otherwise, implementation-defined. |
433
 
434
 
 
81
 
82
  ``` cpp
83
  string s0 = format("{} to {}", "a", "b"); // OK, automatic indexing
84
  string s1 = format("{1} to {0}", "a", "b"); // OK, manual indexing
85
  string s2 = format("{0} to {}", "a", "b"); // not a format string (mixing automatic and manual indexing),
86
+ // ill-formed
87
  string s3 = format("{} to {1}", "a", "b"); // not a format string (mixing automatic and manual indexing),
88
+ // ill-formed
89
  ```
90
 
91
  — *end example*]
92
 
93
  The *format-spec* field contains *format specifications* that define how
 
109
 
110
  — *end example*]
111
 
112
  #### Standard format specifiers <a id="format.string.std">[[format.string.std]]</a>
113
 
114
+ Each `formatter` specialization described in [[format.formatter.spec]]
115
  for fundamental and string types interprets *format-spec* as a
116
  *std-format-spec*.
117
 
118
  [*Note 1*: The format specification can be used to specify such details
119
+ as minimum field width, alignment, padding, and decimal precision. Some
120
+ of the formatting options are only supported for arithmetic
121
  types. — *end note*]
122
 
123
  The syntax of format specifications is as follows:
124
 
125
  ``` bnf
 
159
  '.' '{' arg-idₒₚₜ '}'
160
  ```
161
 
162
  ``` bnf
163
  type one of
164
+ 'a A b B c d e E f F g G o p s x X ?'
165
  ```
166
 
167
+ Field widths are specified in *field width units*; the number of column
168
+ positions required to display a sequence of characters in a terminal.
169
+ The *minimum field width* is the number of field width units a
170
+ replacement field minimally requires of the formatted sequence of
171
+ characters produced for a format argument. The *estimated field width*
172
+ is the number of field width units that are required for the formatted
173
+ sequence of characters produced for a format argument independent of the
174
+ effects of the *width* option. The *padding width* is the greater of `0`
175
+ and the difference of the minimum field width and the estimated field
176
+ width.
177
+
178
+ [*Note 2*: The POSIX `wcswidth` function is an example of a function
179
+ that, given a string, returns the number of column positions required by
180
+ a terminal to display the string. — *end note*]
181
+
182
+ The *fill character* is the character denoted by the *fill* option or,
183
+ if the *fill* option is absent, the space character. For a format
184
+ specification in UTF-8, UTF-16, or UTF-32, the fill character
185
+ corresponds to a single Unicode scalar value.
186
+
187
+ [*Note 3*: The presence of a *fill* option is signaled by the character
188
  following it, which must be one of the alignment options. If the second
189
  character of *std-format-spec* is not a valid alignment option, then it
190
+ is assumed that the *fill* and *align* options are both
191
  absent. — *end note*]
192
 
193
+ The *align* option applies to all argument types. The meaning of the
194
  various alignment options is as specified in [[format.align]].
195
 
196
  [*Example 1*:
197
 
198
  ``` cpp
 
202
  string s2 = format("{:*<6}", 'x'); // value of s2 is "x*****"
203
  string s3 = format("{:*>6}", 'x'); // value of s3 is "*****x"
204
  string s4 = format("{:*^6}", 'x'); // value of s4 is "**x***"
205
  string s5 = format("{:6d}", c); // value of s5 is "\ \ \ 120"
206
  string s6 = format("{:6}", true); // value of s6 is "true\ \ "
207
+ string s7 = format("{:*<6.3}", "123456"); // value of s7 is "123***"
208
+ string s8 = format("{:02}", 1234); // value of s8 is "1234"
209
+ string s9 = format("{:*<}", "12"); // value of s9 is "12"
210
+ string sA = format("{:*<6}", "12345678"); // value of sA is "12345678"
211
  ```
212
 
213
  — *end example*]
214
 
215
+ [*Note 4*: The *fill*, *align*, and `0` options have no effect when the
216
+ minimum field width is not greater than the estimated field width
217
+ because padding width is `0` in that case. Since fill characters are
218
+ assumed to have a field width of `1`, use of a character with a
219
+ different field width can produce misaligned output. The
220
+ U+1f921 (clown face) character has a field width of `2`. The examples
221
+ above that include that character illustrate the effect of the field
222
+ width when that character is used as a fill character as opposed to when
223
+ it is used as a formatting argument. — *end note*]
224
 
225
  **Table: Meaning of align options** <a id="format.align">[format.align]</a>
226
 
227
  | Option | Meaning |
228
+ | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
229
+ | `<` | Forces the formatted argument to be aligned to the start of the field by inserting $n$ fill characters after the formatted argument where $n$ is the padding width. This is the default for non-arithmetic non-pointer types, `charT`, and `bool`, unless an integer presentation type is specified. |
230
+ | % `>` | Forces the formatted argument to be aligned to the end of the field by inserting $n$ fill characters before the formatted argument where $n$ is the padding width. This is the default for arithmetic types other than `charT` and `bool`, pointer types, or when an integer presentation type is specified. |
231
+ | % `^` | Forces the formatted argument to be centered within the field by inserting $\bigl\lfloor \frac{n}{2} \bigr\rfloor$ fill characters before and $\bigl\lceil \frac{n}{2} \bigr\rceil$ fill characters after the formatted argument, where $n$ is the padding width. |
232
 
233
 
234
  The *sign* option is only valid for arithmetic types other than `charT`
235
  and `bool` or when an integer presentation type is specified. The
236
  meaning of the various options is as specified in [[format.sign]].
237
 
238
+ **Table: Meaning of sign options** <a id="format.sign">[format.sign]</a>
239
+
240
+ | Option | Meaning |
241
+ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
242
+ | `+` | Indicates that a sign should be used for both non-negative and negative numbers. The `+` sign is inserted before the output of `to_chars` for non-negative numbers other than negative zero. *For negative numbers and negative zero the output of `to_chars` will already contain the sign so no additional transformation is performed.* |
243
+ | % `-` | Indicates that a sign should be used for negative numbers and negative zero only (this is the default behavior). |
244
+ | % space | Indicates that a leading space should be used for non-negative numbers other than negative zero, and a minus sign for negative numbers and negative zero. |
245
+
246
 
247
  The *sign* option applies to floating-point infinity and NaN.
248
 
249
  [*Example 2*:
250
 
 
270
  contain a decimal-point character, even if no digits follow it.
271
  Normally, a decimal-point character appears in the result of these
272
  conversions only if a digit follows it. In addition, for `g` and `G`
273
  conversions, trailing zeros are not removed from the result.
274
 
275
+ The `0` option is valid for arithmetic types other than `charT` and
276
+ `bool` or when an integer presentation type is specified. For formatting
277
+ arguments that have a value other than an infinity or a NaN, this option
278
+ pads the formatted argument by inserting the `0` character n times
279
+ following the sign or base prefix indicators (if any) where n is `0` if
280
+ the *align* option is present and is the padding width otherwise.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
 
282
  [*Example 3*:
283
 
284
  ``` cpp
285
  char c = 120;
286
  string s1 = format("{:+06d}", c); // value of s1 is "+00120"
287
  string s2 = format("{:#06x}", 0xa); // value of s2 is "0x000a"
288
+ string s3 = format("{:<06}", -42); // value of s3 is "-42\ \ \ " (0 has no effect)
289
+ string s4 = format("{:06}", inf); // value of s4 is "\ \ \ inf" (0 has no effect)
290
  ```
291
 
292
  — *end example*]
293
 
294
+ The *width* option specifies the minimum field width. If the *width*
295
+ option is absent, the minimum field width is `0`.
296
+
297
+ If `{ \opt{arg-id} }` is used in a *width* or *precision* option, the
298
+ value of the corresponding formatting argument is used as the value of
299
+ the option. If the corresponding formatting argument is not of standard
300
+ signed or unsigned integer type, or its value is negative, an exception
301
+ of type `format_error` is thrown.
302
+
303
+ If *positive-integer* is used in a *width* option, the value of the
304
+ *positive-integer* is interpreted as a decimal integer and used as the
305
+ value of the option.
306
+
307
+ For the purposes of width computation, a string is assumed to be in a
308
+ locale-independent, *implementation-defined* encoding. Implementations
309
+ should use either UTF-8, UTF-16, or UTF-32, on platforms capable of
310
+ displaying Unicode text in a terminal.
311
+
312
+ [*Note 5*:
313
+
314
+ This is the case for Windows[^2]
315
+
316
+ -based and many POSIX-based operating systems.
317
+
318
+ — *end note*]
319
+
320
+ For a sequence of characters in UTF-8, UTF-16, or UTF-32, an
321
+ implementation should use as its field width the sum of the field widths
322
+ of the first code point of each extended grapheme cluster. Extended
323
+ grapheme clusters are defined by UAX \#29 of the Unicode Standard. The
324
+ following code points have a field width of 2:
325
+
326
+ - any code point with the `East_Asian_Width="W"` or
327
+ `East_Asian_Width="F"` Derived Extracted Property as described by UAX
328
+ \#44 of the Unicode Standard
329
+ - `U+4dc0` – `U+4dff` (Yijing Hexagram Symbols)
330
+ - `U+1f300` – `U+1f5ff` (Miscellaneous Symbols and Pictographs)
331
+ - `U+1f900` – `U+1f9ff` (Supplemental Symbols and Pictographs)
332
+
333
+ The field width of all other code points is 1.
334
+
335
+ For a sequence of characters in neither UTF-8, UTF-16, nor UTF-32, the
336
+ field width is unspecified.
337
+
338
+ The *precision* option is valid for floating-point and string types. For
339
+ floating-point types, the value of this option specifies the precision
340
+ to be used for the floating-point presentation type. For string types,
341
+ this option specifies the longest prefix of the formatted argument to be
342
+ included in the replacement field such that the field width of the
343
+ prefix is no greater than the value of this option.
344
+
345
+ If *nonnegative-integer* is used in a *precision* option, the value of
346
+ the decimal integer is used as the value of the option.
347
 
348
  When the `L` option is used, the form used for the conversion is called
349
  the *locale-specific form*. The `L` option is only valid for arithmetic
350
  types, and its effect depends upon the type.
351
 
 
366
  [[format.type.string]].
367
 
368
  **Table: Meaning of type options for strings** <a id="format.type.string">[format.type.string]</a>
369
 
370
  | Type | Meaning |
371
+ | --------- | ------------------------------------------------------------------ |
372
  | none, `s` | Copies the string to the output. |
373
+ | % `?` | Copies the escaped string [[format.string.escaped]] to the output. |
374
 
375
 
376
  The meaning of some non-string presentation types is defined in terms of
377
  a call to `to_chars`. In such cases, let \[`first`, `last`) be a range
378
  large enough to hold the `to_chars` output and `value` be the formatting
379
  argument value. Formatting is done as if by calling `to_chars` as
380
  specified and copying the output through the output iterator of the
381
  format context.
382
 
383
+ [*Note 6*: Additional padding and adjustments are performed prior to
384
  copying the output through the output iterator as specified by the
385
  format specifiers. — *end note*]
386
 
387
  The available integer presentation types for integral types other than
388
  `bool` and `charT` are specified in [[format.type.int]].
 
391
 
392
  ``` cpp
393
  string s0 = format("{}", 42); // value of s0 is "42"
394
  string s1 = format("{0:b} {0:d} {0:o} {0:x}", 42); // value of s1 is "101010 42 52 2a"
395
  string s2 = format("{0:#x} {0:#X}", 42); // value of s2 is "0x2a 0X2A"
396
+ string s3 = format("{:L}", 1234); // value of s3 can be "1,234"
397
  // (depending on the locale)
398
  ```
399
 
400
  — *end example*]
401
 
402
+ **Table: Meaning of type options for integer types** <a id="format.type.int">[format.type.int]</a>
403
+
404
+ | Type | Meaning |
405
+ | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
406
+ | `b` | `to_chars(first, last, value, 2)`; \indextext{base prefix}% the base prefix is `0b`. |
407
+ | % `B` | The same as `b`, except that \indextext{base prefix}% the base prefix is `0B`. |
408
+ | % `c` | Copies the character `static_cast<charT>(value)` to the output. Throws `format_error` if `value` is not in the range of representable values for `charT`. |
409
+ | % `d` | `to_chars(first, last, value)`. |
410
+ | % `o` | `to_chars(first, last, value, 8)`; \indextext{base prefix}% the base prefix is `0` if `value` is nonzero and is empty otherwise. |
411
+ | % `x` | `to_chars(first, last, value, 16)`; \indextext{base prefix}% the base prefix is `0x`. |
412
+ | % `X` | The same as `x`, except that it uses uppercase letters for digits above 9 and \indextext{base prefix}% the base prefix is `0X`. |
413
+ | % none | The same as `d`. *If the formatting argument type is `charT` or `bool`, the default is instead `c` or `s`, respectively.* |
414
+
415
 
416
  The available `charT` presentation types are specified in
417
  [[format.type.char]].
418
 
419
  **Table: Meaning of type options for `charT`** <a id="format.type.char">[format.type.char]</a>
420
 
421
  | Type | Meaning |
422
+ | ------------------------------ | --------------------------------------------------------------------- |
423
  | none, `c` | Copies the character to the output. |
424
  | % `b`, `B`, `d`, `o`, `x`, `X` | As specified in [[format.type.int]]. |
425
+ | % `?` | Copies the escaped character [[format.string.escaped]] to the output. |
426
 
427
 
428
  The available `bool` presentation types are specified in
429
  [[format.type.bool]].
430
 
431
  **Table: Meaning of type options for `bool`** <a id="format.type.bool">[format.type.bool]</a>
432
 
433
  | Type | Meaning |
434
+ | ------------------------------ | -------------------------------------------------------------------------------------- |
435
  | none, `s` | Copies textual representation, either `true` or `false`, to the output. |
436
+ | % `b`, `B`, `d`, `o`, `x`, `X` | As specified in [[format.type.int]] for the value `static_cast<unsigned char>(value)`. |
437
 
438
 
439
  The available floating-point presentation types and their meanings for
440
  values other than infinity and NaN are specified in
441
  [[format.type.float]]. For lower-case presentation types, infinity and
442
  NaN are formatted as `inf` and `nan`, respectively. For upper-case
443
  presentation types, infinity and NaN are formatted as `INF` and `NAN`,
444
  respectively.
445
 
446
+ [*Note 7*: In either case, a sign is included if indicated by the
447
  *sign* option. — *end note*]
448
 
449
  **Table: Meaning of type options for floating-point types** <a id="format.type.float">[format.type.float]</a>
450
 
451
  | Type | Meaning |
 
461
 
462
 
463
  The available pointer presentation types and their mapping to `to_chars`
464
  are specified in [[format.type.ptr]].
465
 
466
+ [*Note 8*: Pointer presentation types also apply to
467
  `nullptr_t`. — *end note*]
468
 
469
  **Table: Meaning of type options for pointer types** <a id="format.type.ptr">[format.type.ptr]</a>
470
 
471
  | Type | Meaning |
472
+ | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
473
+ | none, `p` | If `uintptr_t` is defined, \begin{codeblock} to_chars(first, last, reinterpret_cast<uintptr_t>(value), 16) \end{codeblock} with the prefix `0x` inserted immediately before the output of `to_chars`; otherwise, implementation-defined. |
474
 
475