From Jason Turner

[ostream.formatted]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp12o00mcv/{from.md → to.md} +19 -19
tmp/tmp12o00mcv/{from.md → to.md} RENAMED
@@ -5,12 +5,12 @@
5
  Each formatted output function begins execution by constructing an
6
  object of class `sentry`. If this object returns `true` when converted
7
  to a value of type `bool`, the function endeavors to generate the
8
  requested output. If the generation fails, then the formatted output
9
  function does `setstate(ios_base::failbit)`, which might throw an
10
- exception. If an exception is thrown during output, then `ios::badbit`
11
- is turned on[^33] in `*this`’s error state. If
12
  `(exceptions()&badbit) != 0` then the exception is rethrown. Whether or
13
  not an exception is thrown, the `sentry` object is destroyed before
14
  leaving the formatted output function. If no exception is thrown, the
15
  result of the formatted output function is `*this`.
16
 
@@ -151,13 +151,13 @@ in  [[ostream.formatted.reqmts]]).
151
 
152
  ``` cpp
153
  basic_ostream<charT, traits>& operator<<(basic_streambuf<charT, traits>* sb);
154
  ```
155
 
156
- *Effects:* Behaves as an unformatted output function
157
- ([[ostream.unformatted]]). After the sentry object is constructed, if
158
- `sb` is null calls `setstate(badbit)` (which may throw
159
  `ios_base::failure`).
160
 
161
  Gets characters from `sb` and inserts them in `*this`. Characters are
162
  read from `sb` and inserted until any of the following occurs:
163
 
@@ -165,14 +165,14 @@ read from `sb` and inserted until any of the following occurs:
165
  - inserting in the output sequence fails (in which case the character to
166
  be inserted is not extracted);
167
  - an exception occurs while getting a character from `sb`.
168
 
169
  If the function inserts no characters, it calls `setstate(failbit)`
170
- (which may throw `ios_base::failure` ([[iostate.flags]])). If an
171
- exception was thrown while extracting a character, the function sets
172
- `failbit` in error state, and if `failbit` is on in `exceptions()` the
173
- caught exception is rethrown.
174
 
175
  *Returns:* `*this`.
176
 
177
  ``` cpp
178
  basic_ostream<charT, traits>& operator<<(nullptr_t);
@@ -182,11 +182,11 @@ basic_ostream<charT, traits>& operator<<(nullptr_t);
182
 
183
  ``` cpp
184
  return *this << s;
185
  ```
186
 
187
- where `s` is an *implementation-defined* NTCTS ([[defns.ntcts]]).
188
 
189
  ##### Character inserter function templates <a id="ostream.inserters.character">[[ostream.inserters.character]]</a>
190
 
191
  ``` cpp
192
  template<class charT, class traits>
@@ -202,16 +202,16 @@ template<class traits>
202
  template<class traits>
203
  basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>& out, unsigned char c);
204
  ```
205
 
206
  *Effects:* Behaves as a formatted output
207
- function ([[ostream.formatted.reqmts]]) of `out`. Constructs a
208
- character sequence `seq`. If `c` has type `char` and the character type
209
- of the stream is not `char`, then `seq` consists of `out.widen(c)`;
210
- otherwise `seq` consists of `c`. Determines padding for `seq` as
211
- described in  [[ostream.formatted.reqmts]]. Inserts `seq` into `out`.
212
- Calls `os.width(0)`.
213
 
214
  *Returns:* `out`.
215
 
216
  ``` cpp
217
  template<class charT, class traits>
@@ -225,17 +225,17 @@ template<class traits>
225
  template<class traits>
226
  basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>& out,
227
  const unsigned char* s);
228
  ```
229
 
230
- *Requires:* `s` shall not be a null pointer.
231
 
232
  *Effects:* Behaves like a formatted inserter (as described
233
  in  [[ostream.formatted.reqmts]]) of `out`. Creates a character sequence
234
  `seq` of `n` characters starting at `s`, each widened using
235
- `out.widen()` ([[basic.ios.members]]), where `n` is the number that
236
- would be computed as if by:
237
 
238
  - `traits::length(s)` for the overload where the first argument is of
239
  type `basic_ostream<charT, traits>&` and the second is of type
240
  `const charT*`, and also for the overload where the first argument is
241
  of type `basic_ostream<char, traits>&` and the second is of type
 
5
  Each formatted output function begins execution by constructing an
6
  object of class `sentry`. If this object returns `true` when converted
7
  to a value of type `bool`, the function endeavors to generate the
8
  requested output. If the generation fails, then the formatted output
9
  function does `setstate(ios_base::failbit)`, which might throw an
10
+ exception. If an exception is thrown during output, then
11
+ `ios_base::badbit` is turned on[^33] in `*this`’s error state. If
12
  `(exceptions()&badbit) != 0` then the exception is rethrown. Whether or
13
  not an exception is thrown, the `sentry` object is destroyed before
14
  leaving the formatted output function. If no exception is thrown, the
15
  result of the formatted output function is `*this`.
16
 
 
151
 
152
  ``` cpp
153
  basic_ostream<charT, traits>& operator<<(basic_streambuf<charT, traits>* sb);
154
  ```
155
 
156
+ *Effects:* Behaves as an unformatted output
157
+ function [[ostream.unformatted]]. After the sentry object is
158
+ constructed, if `sb` is null calls `setstate(badbit)` (which may throw
159
  `ios_base::failure`).
160
 
161
  Gets characters from `sb` and inserts them in `*this`. Characters are
162
  read from `sb` and inserted until any of the following occurs:
163
 
 
165
  - inserting in the output sequence fails (in which case the character to
166
  be inserted is not extracted);
167
  - an exception occurs while getting a character from `sb`.
168
 
169
  If the function inserts no characters, it calls `setstate(failbit)`
170
+ (which may throw `ios_base::failure` [[iostate.flags]]). If an exception
171
+ was thrown while extracting a character, the function sets `failbit` in
172
+ the error state, and if `failbit` is set in `exceptions()` the caught
173
+ exception is rethrown.
174
 
175
  *Returns:* `*this`.
176
 
177
  ``` cpp
178
  basic_ostream<charT, traits>& operator<<(nullptr_t);
 
182
 
183
  ``` cpp
184
  return *this << s;
185
  ```
186
 
187
+ where `s` is an *implementation-defined* NTCTS [[defns.ntcts]].
188
 
189
  ##### Character inserter function templates <a id="ostream.inserters.character">[[ostream.inserters.character]]</a>
190
 
191
  ``` cpp
192
  template<class charT, class traits>
 
202
  template<class traits>
203
  basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>& out, unsigned char c);
204
  ```
205
 
206
  *Effects:* Behaves as a formatted output
207
+ function [[ostream.formatted.reqmts]] of `out`. Constructs a character
208
+ sequence `seq`. If `c` has type `char` and the character type of the
209
+ stream is not `char`, then `seq` consists of `out.widen(c)`; otherwise
210
+ `seq` consists of `c`. Determines padding for `seq` as described
211
+ in  [[ostream.formatted.reqmts]]. Inserts `seq` into `out`. Calls
212
+ `os.width(0)`.
213
 
214
  *Returns:* `out`.
215
 
216
  ``` cpp
217
  template<class charT, class traits>
 
225
  template<class traits>
226
  basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>& out,
227
  const unsigned char* s);
228
  ```
229
 
230
+ *Preconditions:* `s` is not a null pointer.
231
 
232
  *Effects:* Behaves like a formatted inserter (as described
233
  in  [[ostream.formatted.reqmts]]) of `out`. Creates a character sequence
234
  `seq` of `n` characters starting at `s`, each widened using
235
+ `out.widen()` [[basic.ios.members]], where `n` is the number that would
236
+ be computed as if by:
237
 
238
  - `traits::length(s)` for the overload where the first argument is of
239
  type `basic_ostream<charT, traits>&` and the second is of type
240
  `const charT*`, and also for the overload where the first argument is
241
  of type `basic_ostream<char, traits>&` and the second is of type