From Jason Turner

[format.functions]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpco_r94iq/{from.md → to.md} +53 -43
tmp/tmpco_r94iq/{from.md → to.md} RENAMED
@@ -5,50 +5,50 @@ the iterator categories for which it does not have to be defined. In
5
  these cases the semantics of `a + n` are the same as in
6
  [[algorithms.requirements]].
7
 
8
  ``` cpp
9
  template<class... Args>
10
- string format(string_view fmt, const Args&... args);
11
  ```
12
 
13
  *Effects:* Equivalent to:
14
 
15
  ``` cpp
16
- return vformat(fmt, make_format_args(args...));
17
  ```
18
 
19
  ``` cpp
20
  template<class... Args>
21
- wstring format(wstring_view fmt, const Args&... args);
22
  ```
23
 
24
  *Effects:* Equivalent to:
25
 
26
  ``` cpp
27
- return vformat(fmt, make_wformat_args(args...));
28
  ```
29
 
30
  ``` cpp
31
  template<class... Args>
32
- string format(const locale& loc, string_view fmt, const Args&... args);
33
  ```
34
 
35
  *Effects:* Equivalent to:
36
 
37
  ``` cpp
38
- return vformat(loc, fmt, make_format_args(args...));
39
  ```
40
 
41
  ``` cpp
42
  template<class... Args>
43
- wstring format(const locale& loc, wstring_view fmt, const Args&... args);
44
  ```
45
 
46
  *Effects:* Equivalent to:
47
 
48
  ``` cpp
49
- return vformat(loc, fmt, make_wformat_args(args...));
50
  ```
51
 
52
  ``` cpp
53
  string vformat(string_view fmt, format_args args);
54
  wstring vformat(wstring_view fmt, wformat_args args);
@@ -63,98 +63,108 @@ locale-specific formatting.
63
 
64
  *Throws:* As specified in  [[format.err.report]].
65
 
66
  ``` cpp
67
  template<class Out, class... Args>
68
- Out format_to(Out out, string_view fmt, const Args&... args);
 
 
 
 
 
 
 
 
 
69
  template<class Out, class... Args>
70
- Out format_to(Out out, wstring_view fmt, const Args&... args);
71
  ```
72
 
73
  *Effects:* Equivalent to:
74
 
75
  ``` cpp
76
- using context = basic_format_context<Out, decltype(fmt)::value_type>;
77
- return vformat_to(out, fmt, make_format_args<context>(args...));
78
  ```
79
 
80
  ``` cpp
81
  template<class Out, class... Args>
82
- Out format_to(Out out, const locale& loc, string_view fmt, const Args&... args);
 
 
 
 
 
 
 
 
 
83
  template<class Out, class... Args>
84
- Out format_to(Out out, const locale& loc, wstring_view fmt, const Args&... args);
85
  ```
86
 
87
  *Effects:* Equivalent to:
88
 
89
  ``` cpp
90
- using context = basic_format_context<Out, decltype(fmt)::value_type>;
91
- return vformat_to(out, loc, fmt, make_format_args<context>(args...));
92
  ```
93
 
94
  ``` cpp
95
  template<class Out>
96
- Out vformat_to(Out out, string_view fmt,
97
- format_args_t<type_identity_t<Out>, char> args);
98
  template<class Out>
99
- Out vformat_to(Out out, wstring_view fmt,
100
- format_args_t<type_identity_t<Out>, wchar_t> args);
101
  template<class Out>
102
- Out vformat_to(Out out, const locale& loc, string_view fmt,
103
- format_args_t<type_identity_t<Out>, char> args);
104
  template<class Out>
105
- Out vformat_to(Out out, const locale& loc, wstring_view fmt,
106
- format_args_t<type_identity_t<Out>, wchar_t> args);
107
  ```
108
 
109
  Let `charT` be `decltype(fmt)::value_type`.
110
 
111
  *Constraints:* `Out` satisfies `output_iterator<const charT&>`.
112
 
113
  *Preconditions:* `Out` models `output_iterator<const charT&>`.
114
 
115
  *Effects:* Places the character representation of formatting the
116
  arguments provided by `args`, formatted according to the specifications
117
- given in `fmt`, into the range \[`out`, `out + N`), where `N` is
118
- `formatted_size(fmt, args...)` for the functions without a `loc`
119
- parameter and `formatted_size(loc, fmt, args...)` for the functions with
120
- a `loc` parameter. If present, `loc` is used for locale-specific
121
- formatting.
122
 
123
  *Returns:* `out + N`.
124
 
125
  *Throws:* As specified in  [[format.err.report]].
126
 
127
  ``` cpp
128
  template<class Out, class... Args>
129
  format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
130
- string_view fmt, const Args&... args);
131
  template<class Out, class... Args>
132
  format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
133
- wstring_view fmt, const Args&... args);
134
  template<class Out, class... Args>
135
  format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
136
- const locale& loc, string_view fmt,
137
- const Args&... args);
138
  template<class Out, class... Args>
139
  format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
140
- const locale& loc, wstring_view fmt,
141
- const Args&... args);
142
  ```
143
 
144
  Let
145
 
146
- - `charT` be `decltype(fmt)::value_type`,
147
  - `N` be `formatted_size(fmt, args...)` for the functions without a
148
  `loc` parameter and `formatted_size(loc, fmt, args...)` for the
149
  functions with a `loc` parameter, and
150
  - `M` be `clamp(n, 0, N)`.
151
 
152
  *Constraints:* `Out` satisfies `output_iterator<const charT&>`.
153
 
154
  *Preconditions:* `Out` models `output_iterator<const charT&>`, and
155
- `formatter<``Tᵢ``, charT>` meets the
156
  requirements [[formatter.requirements]] for each `Tᵢ` in `Args`.
157
 
158
  *Effects:* Places the first `M` characters of the character
159
  representation of formatting the arguments provided by `args`, formatted
160
  according to the specifications given in `fmt`, into the range \[`out`,
@@ -164,22 +174,22 @@ according to the specifications given in `fmt`, into the range \[`out`,
164
 
165
  *Throws:* As specified in  [[format.err.report]].
166
 
167
  ``` cpp
168
  template<class... Args>
169
- size_t formatted_size(string_view fmt, const Args&... args);
170
  template<class... Args>
171
- size_t formatted_size(wstring_view fmt, const Args&... args);
172
  template<class... Args>
173
- size_t formatted_size(const locale& loc, string_view fmt, const Args&... args);
174
  template<class... Args>
175
- size_t formatted_size(const locale& loc, wstring_view fmt, const Args&... args);
176
  ```
177
 
178
- Let `charT` be `decltype(fmt)::value_type`.
179
 
180
- *Preconditions:* `formatter<``Tᵢ``, charT>` meets the
181
  requirements [[formatter.requirements]] for each `Tᵢ` in `Args`.
182
 
183
  *Returns:* The number of characters in the character representation of
184
  formatting arguments `args` formatted according to specifications given
185
  in `fmt`. If present, `loc` is used for locale-specific formatting.
 
5
  these cases the semantics of `a + n` are the same as in
6
  [[algorithms.requirements]].
7
 
8
  ``` cpp
9
  template<class... Args>
10
+ string format(format_string<Args...> fmt, Args&&... args);
11
  ```
12
 
13
  *Effects:* Equivalent to:
14
 
15
  ``` cpp
16
+ return vformat(fmt.str, make_format_args(args...));
17
  ```
18
 
19
  ``` cpp
20
  template<class... Args>
21
+ wstring format(wformat_string<Args...> fmt, Args&&... args);
22
  ```
23
 
24
  *Effects:* Equivalent to:
25
 
26
  ``` cpp
27
+ return vformat(fmt.str, make_wformat_args(args...));
28
  ```
29
 
30
  ``` cpp
31
  template<class... Args>
32
+ string format(const locale& loc, format_string<Args...> fmt, Args&&... args);
33
  ```
34
 
35
  *Effects:* Equivalent to:
36
 
37
  ``` cpp
38
+ return vformat(loc, fmt.str, make_format_args(args...));
39
  ```
40
 
41
  ``` cpp
42
  template<class... Args>
43
+ wstring format(const locale& loc, wformat_string<Args...> fmt, Args&&... args);
44
  ```
45
 
46
  *Effects:* Equivalent to:
47
 
48
  ``` cpp
49
+ return vformat(loc, fmt.str, make_wformat_args(args...));
50
  ```
51
 
52
  ``` cpp
53
  string vformat(string_view fmt, format_args args);
54
  wstring vformat(wstring_view fmt, wformat_args args);
 
63
 
64
  *Throws:* As specified in  [[format.err.report]].
65
 
66
  ``` cpp
67
  template<class Out, class... Args>
68
+ Out format_to(Out out, format_string<Args...> fmt, Args&&... args);
69
+ ```
70
+
71
+ *Effects:* Equivalent to:
72
+
73
+ ``` cpp
74
+ return vformat_to(std::move(out), fmt.str, make_format_args(args...));
75
+ ```
76
+
77
+ ``` cpp
78
  template<class Out, class... Args>
79
+ Out format_to(Out out, wformat_string<Args...> fmt, Args&&... args);
80
  ```
81
 
82
  *Effects:* Equivalent to:
83
 
84
  ``` cpp
85
+ return vformat_to(std::move(out), fmt.str, make_wformat_args(args...));
 
86
  ```
87
 
88
  ``` cpp
89
  template<class Out, class... Args>
90
+ Out format_to(Out out, const locale& loc, format_string<Args...> fmt, Args&&... args);
91
+ ```
92
+
93
+ *Effects:* Equivalent to:
94
+
95
+ ``` cpp
96
+ return vformat_to(std::move(out), loc, fmt.str, make_format_args(args...));
97
+ ```
98
+
99
+ ``` cpp
100
  template<class Out, class... Args>
101
+ Out format_to(Out out, const locale& loc, wformat_string<Args...> fmt, Args&&... args);
102
  ```
103
 
104
  *Effects:* Equivalent to:
105
 
106
  ``` cpp
107
+ return vformat_to(std::move(out), loc, fmt.str, make_wformat_args(args...));
 
108
  ```
109
 
110
  ``` cpp
111
  template<class Out>
112
+ Out vformat_to(Out out, string_view fmt, format_args args);
 
113
  template<class Out>
114
+ Out vformat_to(Out out, wstring_view fmt, wformat_args args);
 
115
  template<class Out>
116
+ Out vformat_to(Out out, const locale& loc, string_view fmt, format_args args);
 
117
  template<class Out>
118
+ Out vformat_to(Out out, const locale& loc, wstring_view fmt, wformat_args args);
 
119
  ```
120
 
121
  Let `charT` be `decltype(fmt)::value_type`.
122
 
123
  *Constraints:* `Out` satisfies `output_iterator<const charT&>`.
124
 
125
  *Preconditions:* `Out` models `output_iterator<const charT&>`.
126
 
127
  *Effects:* Places the character representation of formatting the
128
  arguments provided by `args`, formatted according to the specifications
129
+ given in `fmt`, into the range \[`out`, `out + N`), where `N` is the
130
+ number of characters in that character representation. If present, `loc`
131
+ is used for locale-specific formatting.
 
 
132
 
133
  *Returns:* `out + N`.
134
 
135
  *Throws:* As specified in  [[format.err.report]].
136
 
137
  ``` cpp
138
  template<class Out, class... Args>
139
  format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
140
+ format_string<Args...> fmt, Args&&... args);
141
  template<class Out, class... Args>
142
  format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
143
+ wformat_string<Args...> fmt, Args&&... args);
144
  template<class Out, class... Args>
145
  format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
146
+ const locale& loc, format_string<Args...> fmt,
147
+ Args&&... args);
148
  template<class Out, class... Args>
149
  format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
150
+ const locale& loc, wformat_string<Args...> fmt,
151
+ Args&&... args);
152
  ```
153
 
154
  Let
155
 
156
+ - `charT` be `decltype(fmt.`*`str`*`)::value_type`,
157
  - `N` be `formatted_size(fmt, args...)` for the functions without a
158
  `loc` parameter and `formatted_size(loc, fmt, args...)` for the
159
  functions with a `loc` parameter, and
160
  - `M` be `clamp(n, 0, N)`.
161
 
162
  *Constraints:* `Out` satisfies `output_iterator<const charT&>`.
163
 
164
  *Preconditions:* `Out` models `output_iterator<const charT&>`, and
165
+ `formatter<``remove_cvref_t<Tᵢ``>, charT>` meets the
166
  requirements [[formatter.requirements]] for each `Tᵢ` in `Args`.
167
 
168
  *Effects:* Places the first `M` characters of the character
169
  representation of formatting the arguments provided by `args`, formatted
170
  according to the specifications given in `fmt`, into the range \[`out`,
 
174
 
175
  *Throws:* As specified in  [[format.err.report]].
176
 
177
  ``` cpp
178
  template<class... Args>
179
+ size_t formatted_size(format_string<Args...> fmt, Args&&... args);
180
  template<class... Args>
181
+ size_t formatted_size(wformat_string<Args...> fmt, Args&&... args);
182
  template<class... Args>
183
+ size_t formatted_size(const locale& loc, format_string<Args...> fmt, Args&&... args);
184
  template<class... Args>
185
+ size_t formatted_size(const locale& loc, wformat_string<Args...> fmt, Args&&... args);
186
  ```
187
 
188
+ Let `charT` be `decltype(fmt.`*`str`*`)::value_type`.
189
 
190
+ *Preconditions:* `formatter<``remove_cvref_t<Tᵢ``>, charT>` meets the
191
  requirements [[formatter.requirements]] for each `Tᵢ` in `Args`.
192
 
193
  *Returns:* The number of characters in the character representation of
194
  formatting arguments `args` formatted according to specifications given
195
  in `fmt`. If present, `loc` is used for locale-specific formatting.