From Jason Turner

[format.functions]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpepcbrguu/{from.md → to.md} +188 -0
tmp/tmpepcbrguu/{from.md → to.md} RENAMED
@@ -0,0 +1,188 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Formatting functions <a id="format.functions">[[format.functions]]</a>
2
+
3
+ In the description of the functions, operator `+` is used for some of
4
+ 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);
55
+ string vformat(const locale& loc, string_view fmt, format_args args);
56
+ wstring vformat(const locale& loc, wstring_view fmt, wformat_args args);
57
+ ```
58
+
59
+ *Returns:* A string object holding the character representation of
60
+ formatting arguments provided by `args` formatted according to
61
+ specifications given in `fmt`. If present, `loc` is used for
62
+ 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`,
161
+ `out + M`). If present, `loc` is used for locale-specific formatting.
162
+
163
+ *Returns:* `{out + M, N}`.
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.
186
+
187
+ *Throws:* As specified in  [[format.err.report]].
188
+