From Jason Turner

[format.formatter.spec]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpcsqenl27/{from.md → to.md} +14 -14
tmp/tmpcsqenl27/{from.md → to.md} RENAMED
@@ -2,29 +2,29 @@
2
 
3
  The functions defined in [[format.functions]] use specializations of the
4
  class template `formatter` to format individual arguments.
5
 
6
  Let `charT` be either `char` or `wchar_t`. Each specialization of
7
- `formatter` is either enabled or disabled, as described below.
 
 
 
 
 
 
8
 
9
- [*Note 1*: Enabled specializations meet the requirements, and disabled
10
- specializations do not. — *end note*]
11
-
12
- Each header that declares the template `formatter` provides the
13
- following enabled specializations:
14
-
15
- - The specializations
16
  ``` cpp
17
  template<> struct formatter<char, char>;
18
  template<> struct formatter<char, wchar_t>;
19
  template<> struct formatter<wchar_t, wchar_t>;
20
  ```
21
- - For each `charT`, the string type specializations
22
  ``` cpp
23
  template<> struct formatter<charT*, charT>;
24
  template<> struct formatter<const charT*, charT>;
25
- template<size_t N> struct formatter<const charT[N], charT>;
26
  template<class traits, class Allocator>
27
  struct formatter<basic_string<charT, traits, Allocator>, charT>;
28
  template<class traits>
29
  struct formatter<basic_string_view<charT, traits>, charT>;
30
  ```
@@ -43,21 +43,21 @@ following enabled specializations:
43
 
44
  The `parse` member functions of these formatters interpret the format
45
  specification as a *std-format-spec* as described in
46
  [[format.string.std]].
47
 
48
- [*Note 2*: Specializations such as `formatter<wchar_t, char>` and
49
  `formatter<const char*, wchar_t>` that would require implicit multibyte
50
  / wide string or character conversion are disabled. — *end note*]
51
 
52
  For any types `T` and `charT` for which neither the library nor the user
53
  provides an explicit or partial specialization of the class template
54
  `formatter`, `formatter<T, charT>` is disabled.
55
 
56
  If the library provides an explicit or partial specialization of
57
- `formatter<T, charT>`, that specialization is enabled except as noted
58
- otherwise.
59
 
60
  If `F` is a disabled specialization of `formatter`, these values are
61
  `false`:
62
 
63
  - `is_default_constructible_v<F>`,
@@ -76,11 +76,11 @@ An enabled specialization `formatter<T, charT>` meets the requirements
76
 
77
  enum color { red, green, blue };
78
  const char* color_names[] = { "red", "green", "blue" };
79
 
80
  template<> struct std::formatter<color> : std::formatter<const char*> {
81
- auto format(color c, format_context& ctx) {
82
  return formatter<const char*>::format(color_names[c], ctx);
83
  }
84
  };
85
 
86
  struct err {};
 
2
 
3
  The functions defined in [[format.functions]] use specializations of the
4
  class template `formatter` to format individual arguments.
5
 
6
  Let `charT` be either `char` or `wchar_t`. Each specialization of
7
+ `formatter` is either enabled or disabled, as described below. A
8
+ *debug-enabled* specialization of `formatter` additionally provides a
9
+ public, constexpr, non-static member function `set_debug_format()` which
10
+ modifies the state of the `formatter` to be as if the type of the
11
+ *std-format-spec* parsed by the last call to `parse` were `?`. Each
12
+ header that declares the template `formatter` provides the following
13
+ enabled specializations:
14
 
15
+ - The debug-enabled specializations
 
 
 
 
 
 
16
  ``` cpp
17
  template<> struct formatter<char, char>;
18
  template<> struct formatter<char, wchar_t>;
19
  template<> struct formatter<wchar_t, wchar_t>;
20
  ```
21
+ - For each `charT`, the debug-enabled string type specializations
22
  ``` cpp
23
  template<> struct formatter<charT*, charT>;
24
  template<> struct formatter<const charT*, charT>;
25
+ template<size_t N> struct formatter<charT[N], charT>;
26
  template<class traits, class Allocator>
27
  struct formatter<basic_string<charT, traits, Allocator>, charT>;
28
  template<class traits>
29
  struct formatter<basic_string_view<charT, traits>, charT>;
30
  ```
 
43
 
44
  The `parse` member functions of these formatters interpret the format
45
  specification as a *std-format-spec* as described in
46
  [[format.string.std]].
47
 
48
+ [*Note 1*: Specializations such as `formatter<wchar_t, char>` and
49
  `formatter<const char*, wchar_t>` that would require implicit multibyte
50
  / wide string or character conversion are disabled. — *end note*]
51
 
52
  For any types `T` and `charT` for which neither the library nor the user
53
  provides an explicit or partial specialization of the class template
54
  `formatter`, `formatter<T, charT>` is disabled.
55
 
56
  If the library provides an explicit or partial specialization of
57
+ `formatter<T, charT>`, that specialization is enabled and meets the
58
+ requirements except as noted otherwise.
59
 
60
  If `F` is a disabled specialization of `formatter`, these values are
61
  `false`:
62
 
63
  - `is_default_constructible_v<F>`,
 
76
 
77
  enum color { red, green, blue };
78
  const char* color_names[] = { "red", "green", "blue" };
79
 
80
  template<> struct std::formatter<color> : std::formatter<const char*> {
81
+ auto format(color c, format_context& ctx) const {
82
  return formatter<const char*>::format(color_names[c], ctx);
83
  }
84
  };
85
 
86
  struct err {};