From Jason Turner

[output.streams]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpqjo2jslz/{from.md → to.md} +210 -86
tmp/tmpqjo2jslz/{from.md → to.md} RENAMED
@@ -1,13 +1,21 @@
1
  ### Output streams <a id="output.streams">[[output.streams]]</a>
2
 
3
- The header `<ostream>` defines a type and several function signatures
4
- that control output to a stream buffer along with a function template
5
- that inserts into stream rvalues.
 
 
6
 
7
  #### Class template `basic_ostream` <a id="ostream">[[ostream]]</a>
8
 
 
 
 
 
 
 
9
  ``` cpp
10
  namespace std {
11
  template<class charT, class traits = char_traits<charT>>
12
  class basic_ostream : virtual public basic_ios<charT, traits> {
13
  public:
@@ -24,51 +32,50 @@ namespace std {
24
 
25
  // [ostream.sentry], prefix/suffix
26
  class sentry;
27
 
28
  // [ostream.formatted], formatted output
29
- basic_ostream<charT, traits>&
30
- operator<<(basic_ostream<charT, traits>& (*pf)(basic_ostream<charT, traits>&));
31
- basic_ostream<charT, traits>&
32
- operator<<(basic_ios<charT, traits>& (*pf)(basic_ios<charT, traits>&));
33
- basic_ostream<charT, traits>&
34
- operator<<(ios_base& (*pf)(ios_base&));
35
 
36
- basic_ostream<charT, traits>& operator<<(bool n);
37
- basic_ostream<charT, traits>& operator<<(short n);
38
- basic_ostream<charT, traits>& operator<<(unsigned short n);
39
- basic_ostream<charT, traits>& operator<<(int n);
40
- basic_ostream<charT, traits>& operator<<(unsigned int n);
41
- basic_ostream<charT, traits>& operator<<(long n);
42
- basic_ostream<charT, traits>& operator<<(unsigned long n);
43
- basic_ostream<charT, traits>& operator<<(long long n);
44
- basic_ostream<charT, traits>& operator<<(unsigned long long n);
45
- basic_ostream<charT, traits>& operator<<(float f);
46
- basic_ostream<charT, traits>& operator<<(double f);
47
- basic_ostream<charT, traits>& operator<<(long double f);
 
48
 
49
- basic_ostream<charT, traits>& operator<<(const void* p);
50
- basic_ostream<charT, traits>& operator<<(nullptr_t);
51
- basic_ostream<charT, traits>& operator<<(basic_streambuf<char_type, traits>* sb);
 
52
 
53
  // [ostream.unformatted], unformatted output
54
- basic_ostream<charT, traits>& put(char_type c);
55
- basic_ostream<charT, traits>& write(const char_type* s, streamsize n);
56
 
57
- basic_ostream<charT, traits>& flush();
58
 
59
  // [ostream.seeks], seeks
60
  pos_type tellp();
61
- basic_ostream<charT, traits>& seekp(pos_type);
62
- basic_ostream<charT, traits>& seekp(off_type, ios_base::seekdir);
63
 
64
  protected:
65
  // [ostream.cons], copy/move constructor
66
  basic_ostream(const basic_ostream&) = delete;
67
  basic_ostream(basic_ostream&& rhs);
68
 
69
- // [ostream.assign], assign and swap
70
  basic_ostream& operator=(const basic_ostream&) = delete;
71
  basic_ostream& operator=(basic_ostream&& rhs);
72
  void swap(basic_ostream& rhs);
73
  };
74
 
@@ -204,15 +211,16 @@ void swap(basic_ostream& rhs);
204
 
205
  ##### Class `basic_ostream::sentry` <a id="ostream.sentry">[[ostream.sentry]]</a>
206
 
207
  ``` cpp
208
  namespace std {
209
- template<class charT, class traits = char_traits<charT>>
210
  class basic_ostream<charT, traits>::sentry {
211
  bool ok_; // exposition only
 
212
  public:
213
- explicit sentry(basic_ostream<charT, traits>& os);
214
  ~sentry();
215
  explicit operator bool() const { return ok_; }
216
 
217
  sentry(const sentry&) = delete;
218
  sentry& operator=(const sentry&) = delete;
@@ -222,20 +230,20 @@ namespace std {
222
 
223
  The class `sentry` defines a class that is responsible for doing
224
  exception safe prefix and suffix operations.
225
 
226
  ``` cpp
227
- explicit sentry(basic_ostream<charT, traits>& os);
228
  ```
229
 
230
  If `os.good()` is nonzero, prepares for formatted or unformatted output.
231
- If `os.tie()` is not a null pointer, calls `os.tie()->flush()`.[^31]
232
 
233
  If, after any preparation is completed, `os.good()` is `true`,
234
  `ok_ == true` otherwise, `ok_ == false`. During preparation, the
235
  constructor may call `setstate(failbit)` (which may throw
236
- `ios_base::failure` [[iostate.flags]]).[^32]
237
 
238
  ``` cpp
239
  ~sentry();
240
  ```
241
 
@@ -261,22 +269,22 @@ pos_type tellp();
261
 
262
  *Returns:* If `fail() != false`, returns `pos_type(-1)` to indicate
263
  failure. Otherwise, returns `rdbuf()->pubseekoff(0, cur, out)`.
264
 
265
  ``` cpp
266
- basic_ostream<charT, traits>& seekp(pos_type pos);
267
  ```
268
 
269
  *Effects:* If `fail() != true`, executes
270
  `rdbuf()->pubseekpos(pos, ios_base::out)`. In case of failure, the
271
  function calls `setstate(failbit)` (which may throw
272
  `ios_base::failure`).
273
 
274
  *Returns:* `*this`.
275
 
276
  ``` cpp
277
- basic_ostream<charT, traits>& seekp(off_type off, ios_base::seekdir dir);
278
  ```
279
 
280
  *Effects:* If `fail() != true`, executes
281
  `rdbuf()->pubseekoff(off, dir, ios_base::out)`. In case of failure, the
282
  function calls `setstate(failbit)` (which may throw
@@ -287,20 +295,22 @@ function calls `setstate(failbit)` (which may throw
287
  #### Formatted output functions <a id="ostream.formatted">[[ostream.formatted]]</a>
288
 
289
  ##### Common requirements <a id="ostream.formatted.reqmts">[[ostream.formatted.reqmts]]</a>
290
 
291
  Each formatted output function begins execution by constructing an
292
- object of class `sentry`. If this object returns `true` when converted
293
  to a value of type `bool`, the function endeavors to generate the
294
  requested output. If the generation fails, then the formatted output
295
- function does `setstate(ios_base::failbit)`, which might throw an
296
  exception. If an exception is thrown during output, then
297
- `ios_base::badbit` is turned on[^33] in `*this`’s error state. If
298
- `(exceptions()&badbit) != 0` then the exception is rethrown. Whether or
299
- not an exception is thrown, the `sentry` object is destroyed before
300
- leaving the formatted output function. If no exception is thrown, the
301
- result of the formatted output function is `*this`.
 
 
302
 
303
  The descriptions of the individual formatted output functions describe
304
  how they perform output and do not mention the `sentry` object.
305
 
306
  If a formatted output function of a stream `os` determines padding, it
@@ -313,23 +323,23 @@ the fill characters are placed after the character sequence; otherwise,
313
  they are placed before the character sequence.
314
 
315
  ##### Arithmetic inserters <a id="ostream.inserters.arithmetic">[[ostream.inserters.arithmetic]]</a>
316
 
317
  ``` cpp
318
- operator<<(bool val);
319
- operator<<(short val);
320
- operator<<(unsigned short val);
321
- operator<<(int val);
322
- operator<<(unsigned int val);
323
- operator<<(long val);
324
- operator<<(unsigned long val);
325
- operator<<(long long val);
326
- operator<<(unsigned long long val);
327
- operator<<(float val);
328
- operator<<(double val);
329
- operator<<(long double val);
330
- operator<<(const void* val);
331
  ```
332
 
333
  *Effects:* The classes `num_get<>` and `num_put<>` handle
334
  locale-dependent numeric formatting and parsing. These inserter
335
  functions use the imbued `locale` value to perform numeric formatting.
@@ -400,49 +410,90 @@ It provides formatting specifications such as field width, and a locale
400
  from which to obtain other facets. If `failed` is `true` then does
401
  `setstate(badbit)`, which may throw an exception, and returns.
402
 
403
  *Returns:* `*this`.
404
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
405
  ##### `basic_ostream::operator<<` <a id="ostream.inserters">[[ostream.inserters]]</a>
406
 
407
  ``` cpp
408
- basic_ostream<charT, traits>&
409
- operator<<(basic_ostream<charT, traits>& (*pf)(basic_ostream<charT, traits>&));
410
  ```
411
 
412
  *Effects:* None. Does not behave as a formatted output function (as
413
  described in  [[ostream.formatted.reqmts]]).
414
 
415
- *Returns:* `pf(*this)`.[^34]
416
 
417
  ``` cpp
418
- basic_ostream<charT, traits>&
419
- operator<<(basic_ios<charT, traits>& (*pf)(basic_ios<charT, traits>&));
420
  ```
421
 
422
  *Effects:* Calls `pf(*this)`. This inserter does not behave as a
423
  formatted output function (as described
424
  in  [[ostream.formatted.reqmts]]).
425
 
426
- *Returns:* `*this`.[^35]
427
 
428
  ``` cpp
429
- basic_ostream<charT, traits>& operator<<(ios_base& (*pf)(ios_base&));
430
  ```
431
 
432
  *Effects:* Calls `pf(*this)`. This inserter does not behave as a
433
  formatted output function (as described
434
  in  [[ostream.formatted.reqmts]]).
435
 
436
  *Returns:* `*this`.
437
 
438
  ``` cpp
439
- basic_ostream<charT, traits>& operator<<(basic_streambuf<charT, traits>* sb);
440
  ```
441
 
442
  *Effects:* Behaves as an unformatted output
443
- function [[ostream.unformatted]]. After the sentry object is
444
  constructed, if `sb` is null calls `setstate(badbit)` (which may throw
445
  `ios_base::failure`).
446
 
447
  Gets characters from `sb` and inserts them in `*this`. Characters are
448
  read from `sb` and inserted until any of the following occurs:
@@ -459,11 +510,11 @@ the error state, and if `failbit` is set in `exceptions()` the caught
459
  exception is rethrown.
460
 
461
  *Returns:* `*this`.
462
 
463
  ``` cpp
464
- basic_ostream<charT, traits>& operator<<(nullptr_t);
465
  ```
466
 
467
  *Effects:* Equivalent to:
468
 
469
  ``` cpp
@@ -536,29 +587,98 @@ Determines padding for `seq` as described
536
  in  [[ostream.formatted.reqmts]]. Inserts `seq` into `out`. Calls
537
  `width(0)`.
538
 
539
  *Returns:* `out`.
540
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
541
  #### Unformatted output functions <a id="ostream.unformatted">[[ostream.unformatted]]</a>
542
 
543
  Each unformatted output function begins execution by constructing an
544
- object of class `sentry`. If this object returns `true`, while
545
  converting to a value of type `bool`, the function endeavors to generate
546
  the requested output. If an exception is thrown during output, then
547
- `ios_base::badbit` is turned on[^36] in `*this`’s error state. If
548
- `(exceptions() & badbit) != 0` then the exception is rethrown. In any
549
- case, the unformatted output function ends by destroying the sentry
550
- object, then, if no exception was thrown, returning the value specified
551
- for the unformatted output function.
 
552
 
553
  ``` cpp
554
- basic_ostream<charT, traits>& put(char_type c);
555
  ```
556
 
557
  *Effects:* Behaves as an unformatted output function (as described
558
- above). After constructing a sentry object, inserts the character `c`,
559
- if possible.[^37]
560
 
561
  Otherwise, calls `setstate(badbit)` (which may throw `ios_base::failure`
562
  [[iostate.flags]]).
563
 
564
  *Returns:* `*this`.
@@ -566,14 +686,15 @@ Otherwise, calls `setstate(badbit)` (which may throw `ios_base::failure`
566
  ``` cpp
567
  basic_ostream& write(const char_type* s, streamsize n);
568
  ```
569
 
570
  *Effects:* Behaves as an unformatted output function (as described
571
- above). After constructing a sentry object, obtains characters to insert
572
- from successive locations of an array whose first element is designated
573
- by `s`.[^38] Characters are inserted until either of the following
574
- occurs:
 
575
 
576
  - `n` characters are inserted;
577
  - inserting in the output sequence fails (in which case the function
578
  calls `setstate(badbit)`, which may throw `ios_base::failure`
579
  [[iostate.flags]]).
@@ -583,15 +704,15 @@ occurs:
583
  ``` cpp
584
  basic_ostream& flush();
585
  ```
586
 
587
  *Effects:* Behaves as an unformatted output function (as described
588
- above). If `rdbuf()` is not a null pointer, constructs a sentry object.
589
- If this object returns `true` when converted to a value of type `bool`
590
- the function calls `rdbuf()->pubsync()`. If that function returns -1
591
- calls `setstate(badbit)` (which may throw `ios_base::failure`
592
- [[iostate.flags]]). Otherwise, if the sentry object returns `false`,
593
  does nothing.
594
 
595
  *Returns:* `*this`.
596
 
597
  #### Standard manipulators <a id="ostream.manip">[[ostream.manip]]</a>
@@ -661,11 +782,14 @@ template<class charT, class traits>
661
  basic_ostream<charT, traits>& flush_emit(basic_ostream<charT, traits>& os);
662
  ```
663
 
664
  *Effects:* Calls `os.flush()`. Then, if `os.rdbuf()` is a
665
  `basic_syncbuf<charT, traits, Allocator>*`, called `buf` for the purpose
666
- of exposition, calls `buf->emit()`.
 
 
 
667
 
668
  *Returns:* `os`.
669
 
670
  #### Rvalue stream insertion <a id="ostream.rvalue">[[ostream.rvalue]]</a>
671
 
 
1
  ### Output streams <a id="output.streams">[[output.streams]]</a>
2
 
3
+ #### General <a id="output.streams.general">[[output.streams.general]]</a>
4
+
5
+ The header `<ostream>` defines a class template and several function
6
+ templates that control output to a stream buffer, along with a function
7
+ template that inserts into stream rvalues.
8
 
9
  #### Class template `basic_ostream` <a id="ostream">[[ostream]]</a>
10
 
11
+ ##### General <a id="ostream.general">[[ostream.general]]</a>
12
+
13
+ When a function has a parameter type `extended-floating-point-type`, the
14
+ implementation provides overloads for all cv-unqualified extended
15
+ floating-point types [[basic.fundamental]].
16
+
17
  ``` cpp
18
  namespace std {
19
  template<class charT, class traits = char_traits<charT>>
20
  class basic_ostream : virtual public basic_ios<charT, traits> {
21
  public:
 
32
 
33
  // [ostream.sentry], prefix/suffix
34
  class sentry;
35
 
36
  // [ostream.formatted], formatted output
37
+ basic_ostream& operator<<(basic_ostream& (*pf)(basic_ostream&));
38
+ basic_ostream& operator<<(basic_ios<charT, traits>& (*pf)(basic_ios<charT, traits>&));
39
+ basic_ostream& operator<<(ios_base& (*pf)(ios_base&));
 
 
 
40
 
41
+ basic_ostream& operator<<(bool n);
42
+ basic_ostream& operator<<(short n);
43
+ basic_ostream& operator<<(unsigned short n);
44
+ basic_ostream& operator<<(int n);
45
+ basic_ostream& operator<<(unsigned int n);
46
+ basic_ostream& operator<<(long n);
47
+ basic_ostream& operator<<(unsigned long n);
48
+ basic_ostream& operator<<(long long n);
49
+ basic_ostream& operator<<(unsigned long long n);
50
+ basic_ostream& operator<<(float f);
51
+ basic_ostream& operator<<(double f);
52
+ basic_ostream& operator<<(long double f);
53
+ basic_ostream& operator<<(extended-floating-point-type f);
54
 
55
+ basic_ostream& operator<<(const void* p);
56
+ basic_ostream& operator<<(const volatile void* p);
57
+ basic_ostream& operator<<(nullptr_t);
58
+ basic_ostream& operator<<(basic_streambuf<char_type, traits>* sb);
59
 
60
  // [ostream.unformatted], unformatted output
61
+ basic_ostream& put(char_type c);
62
+ basic_ostream& write(const char_type* s, streamsize n);
63
 
64
+ basic_ostream& flush();
65
 
66
  // [ostream.seeks], seeks
67
  pos_type tellp();
68
+ basic_ostream& seekp(pos_type);
69
+ basic_ostream& seekp(off_type, ios_base::seekdir);
70
 
71
  protected:
72
  // [ostream.cons], copy/move constructor
73
  basic_ostream(const basic_ostream&) = delete;
74
  basic_ostream(basic_ostream&& rhs);
75
 
76
+ // [ostream.assign], assignment and swap
77
  basic_ostream& operator=(const basic_ostream&) = delete;
78
  basic_ostream& operator=(basic_ostream&& rhs);
79
  void swap(basic_ostream& rhs);
80
  };
81
 
 
211
 
212
  ##### Class `basic_ostream::sentry` <a id="ostream.sentry">[[ostream.sentry]]</a>
213
 
214
  ``` cpp
215
  namespace std {
216
+ template<class charT, class traits>
217
  class basic_ostream<charT, traits>::sentry {
218
  bool ok_; // exposition only
219
+
220
  public:
221
+ explicit sentry(basic_ostream& os);
222
  ~sentry();
223
  explicit operator bool() const { return ok_; }
224
 
225
  sentry(const sentry&) = delete;
226
  sentry& operator=(const sentry&) = delete;
 
230
 
231
  The class `sentry` defines a class that is responsible for doing
232
  exception safe prefix and suffix operations.
233
 
234
  ``` cpp
235
+ explicit sentry(basic_ostream& os);
236
  ```
237
 
238
  If `os.good()` is nonzero, prepares for formatted or unformatted output.
239
+ If `os.tie()` is not a null pointer, calls `os.tie()->flush()`.[^29]
240
 
241
  If, after any preparation is completed, `os.good()` is `true`,
242
  `ok_ == true` otherwise, `ok_ == false`. During preparation, the
243
  constructor may call `setstate(failbit)` (which may throw
244
+ `ios_base::failure` [[iostate.flags]]).[^30]
245
 
246
  ``` cpp
247
  ~sentry();
248
  ```
249
 
 
269
 
270
  *Returns:* If `fail() != false`, returns `pos_type(-1)` to indicate
271
  failure. Otherwise, returns `rdbuf()->pubseekoff(0, cur, out)`.
272
 
273
  ``` cpp
274
+ basic_ostream& seekp(pos_type pos);
275
  ```
276
 
277
  *Effects:* If `fail() != true`, executes
278
  `rdbuf()->pubseekpos(pos, ios_base::out)`. In case of failure, the
279
  function calls `setstate(failbit)` (which may throw
280
  `ios_base::failure`).
281
 
282
  *Returns:* `*this`.
283
 
284
  ``` cpp
285
+ basic_ostream& seekp(off_type off, ios_base::seekdir dir);
286
  ```
287
 
288
  *Effects:* If `fail() != true`, executes
289
  `rdbuf()->pubseekoff(off, dir, ios_base::out)`. In case of failure, the
290
  function calls `setstate(failbit)` (which may throw
 
295
  #### Formatted output functions <a id="ostream.formatted">[[ostream.formatted]]</a>
296
 
297
  ##### Common requirements <a id="ostream.formatted.reqmts">[[ostream.formatted.reqmts]]</a>
298
 
299
  Each formatted output function begins execution by constructing an
300
+ object of class `sentry`. If that object returns `true` when converted
301
  to a value of type `bool`, the function endeavors to generate the
302
  requested output. If the generation fails, then the formatted output
303
+ function does `setstate(ios_base::failbit)`, which can throw an
304
  exception. If an exception is thrown during output, then
305
+ `ios_base::badbit` is set[^31]
306
+
307
+ in `*this`’s error state. If `(exceptions()&badbit) != 0` then the
308
+ exception is rethrown. Whether or not an exception is thrown, the
309
+ `sentry` object is destroyed before leaving the formatted output
310
+ function. If no exception is thrown, the result of the formatted output
311
+ function is `*this`.
312
 
313
  The descriptions of the individual formatted output functions describe
314
  how they perform output and do not mention the `sentry` object.
315
 
316
  If a formatted output function of a stream `os` determines padding, it
 
323
  they are placed before the character sequence.
324
 
325
  ##### Arithmetic inserters <a id="ostream.inserters.arithmetic">[[ostream.inserters.arithmetic]]</a>
326
 
327
  ``` cpp
328
+ basic_ostream& operator<<(bool val);
329
+ basic_ostream& operator<<(short val);
330
+ basic_ostream& operator<<(unsigned short val);
331
+ basic_ostream& operator<<(int val);
332
+ basic_ostream& operator<<(unsigned int val);
333
+ basic_ostream& operator<<(long val);
334
+ basic_ostream& operator<<(unsigned long val);
335
+ basic_ostream& operator<<(long long val);
336
+ basic_ostream& operator<<(unsigned long long val);
337
+ basic_ostream& operator<<(float val);
338
+ basic_ostream& operator<<(double val);
339
+ basic_ostream& operator<<(long double val);
340
+ basic_ostream& operator<<(const void* val);
341
  ```
342
 
343
  *Effects:* The classes `num_get<>` and `num_put<>` handle
344
  locale-dependent numeric formatting and parsing. These inserter
345
  functions use the imbued `locale` value to perform numeric formatting.
 
410
  from which to obtain other facets. If `failed` is `true` then does
411
  `setstate(badbit)`, which may throw an exception, and returns.
412
 
413
  *Returns:* `*this`.
414
 
415
+ ``` cpp
416
+ basic_ostream& operator<<(const volatile void* p);
417
+ ```
418
+
419
+ *Effects:* Equivalent to:
420
+ `return operator<<(const_cast<const void*>(p));`
421
+
422
+ ``` cpp
423
+ basic_ostream& operator<<(extended-floating-point-type val);
424
+ ```
425
+
426
+ *Effects:* If the floating-point conversion rank of
427
+ *`extended-floating-point-type`* is less than or equal to that of
428
+ `double`, the formatting conversion occurs as if it performed the
429
+ following code fragment:
430
+
431
+ ``` cpp
432
+ bool failed = use_facet<
433
+ num_put<charT, ostreambuf_iterator<charT, traits>>
434
+ >(getloc()).put(*this, *this, fill(),
435
+ static_cast<double>(val)).failed();
436
+ ```
437
+
438
+ Otherwise, if the floating-point conversion rank of
439
+ *`extended-floating-point-type`* is less than or equal to that of
440
+ `long double`, the formatting conversion occurs as if it performed the
441
+ following code fragment:
442
+
443
+ ``` cpp
444
+ bool failed = use_facet<
445
+ num_put<charT, ostreambuf_iterator<charT, traits>>
446
+ >(getloc()).put(*this, *this, fill(),
447
+ static_cast<long double>(val)).failed();
448
+ ```
449
+
450
+ Otherwise, an invocation of the operator function is conditionally
451
+ supported with *implementation-defined* semantics.
452
+
453
+ If `failed` is `true` then does `setstate(badbit)`, which may throw an
454
+ exception, and returns.
455
+
456
+ *Returns:* `*this`.
457
+
458
  ##### `basic_ostream::operator<<` <a id="ostream.inserters">[[ostream.inserters]]</a>
459
 
460
  ``` cpp
461
+ basic_ostream& operator<<(basic_ostream& (*pf)(basic_ostream&));
 
462
  ```
463
 
464
  *Effects:* None. Does not behave as a formatted output function (as
465
  described in  [[ostream.formatted.reqmts]]).
466
 
467
+ *Returns:* `pf(*this)`.[^32]
468
 
469
  ``` cpp
470
+ basic_ostream& operator<<(basic_ios<charT, traits>& (*pf)(basic_ios<charT, traits>&));
 
471
  ```
472
 
473
  *Effects:* Calls `pf(*this)`. This inserter does not behave as a
474
  formatted output function (as described
475
  in  [[ostream.formatted.reqmts]]).
476
 
477
+ *Returns:* `*this`.[^33]
478
 
479
  ``` cpp
480
+ basic_ostream& operator<<(ios_base& (*pf)(ios_base&));
481
  ```
482
 
483
  *Effects:* Calls `pf(*this)`. This inserter does not behave as a
484
  formatted output function (as described
485
  in  [[ostream.formatted.reqmts]]).
486
 
487
  *Returns:* `*this`.
488
 
489
  ``` cpp
490
+ basic_ostream& operator<<(basic_streambuf<charT, traits>* sb);
491
  ```
492
 
493
  *Effects:* Behaves as an unformatted output
494
+ function [[ostream.unformatted]]. After the `sentry` object is
495
  constructed, if `sb` is null calls `setstate(badbit)` (which may throw
496
  `ios_base::failure`).
497
 
498
  Gets characters from `sb` and inserts them in `*this`. Characters are
499
  read from `sb` and inserted until any of the following occurs:
 
510
  exception is rethrown.
511
 
512
  *Returns:* `*this`.
513
 
514
  ``` cpp
515
+ basic_ostream& operator<<(nullptr_t);
516
  ```
517
 
518
  *Effects:* Equivalent to:
519
 
520
  ``` cpp
 
587
  in  [[ostream.formatted.reqmts]]. Inserts `seq` into `out`. Calls
588
  `width(0)`.
589
 
590
  *Returns:* `out`.
591
 
592
+ ##### Print <a id="ostream.formatted.print">[[ostream.formatted.print]]</a>
593
+
594
+ ``` cpp
595
+ template<class... Args>
596
+ void print(ostream& os, format_string<Args...> fmt, Args&&... args);
597
+ ```
598
+
599
+ *Effects:* If the ordinary literal encoding [[lex.charset]] is UTF-8,
600
+ equivalent to:
601
+
602
+ ``` cpp
603
+ vprint_unicode(os, fmt.str, make_format_args(std::forward<Args>(args)...));
604
+ ```
605
+
606
+ Otherwise, equivalent to:
607
+
608
+ ``` cpp
609
+ vprint_nonunicode(os, fmt.str, make_format_args(std::forward<Args>(args)...));
610
+ ```
611
+
612
+ ``` cpp
613
+ template<class... Args>
614
+ void println(ostream& os, format_string<Args...> fmt, Args&&... args);
615
+ ```
616
+
617
+ *Effects:* Equivalent to:
618
+
619
+ ``` cpp
620
+ print(os, "{}\n", format(fmt, std::forward<Args>(args)...));
621
+ ```
622
+
623
+ ``` cpp
624
+ void vprint_unicode(ostream& os, string_view fmt, format_args args);
625
+ void vprint_nonunicode(ostream& os, string_view fmt, format_args args);
626
+ ```
627
+
628
+ *Effects:* Behaves as a formatted output
629
+ function [[ostream.formatted.reqmts]] of `os`, except that:
630
+
631
+ - failure to generate output is reported as specified below, and
632
+ - any exception thrown by the call to `vformat` is propagated without
633
+ regard to the value of `os.exceptions()` and without turning on
634
+ `ios_base::badbit` in the error state of `os`.
635
+
636
+ After constructing a `sentry` object, the function initializes an
637
+ automatic variable via
638
+
639
+ ``` cpp
640
+ string out = vformat(os.getloc(), fmt, args);
641
+ ```
642
+
643
+ If the function is `vprint_unicode` and `os` is a stream that refers to
644
+ a terminal capable of displaying Unicode which is determined in an
645
+ implementation-defined manner, writes `out` to the terminal using the
646
+ native Unicode API; if `out` contains invalid code units, the behavior
647
+ is undefined and implementations are encouraged to diagnose it. If the
648
+ native Unicode API is used, the function flushes `os` before writing
649
+ `out`. Otherwise (if `os` is not such a stream or the function is
650
+ `vprint_nonunicode`), inserts the character sequence \[`out.begin()`,
651
+ `out.end()`) into `os`. If writing to the terminal or inserting into
652
+ `os` fails, calls `os.setstate(ios_base::badbit)` (which may throw
653
+ `ios_base::failure`).
654
+
655
+ *Recommended practice:* For `vprint_unicode`, if invoking the native
656
+ Unicode API requires transcoding, implementations should substitute
657
+ invalid code units with U+fffd (replacement character) per the Unicode
658
+ Standard, Chapter 3.9 ‘U+fffd‘ Substitution in Conversion.
659
+
660
  #### Unformatted output functions <a id="ostream.unformatted">[[ostream.unformatted]]</a>
661
 
662
  Each unformatted output function begins execution by constructing an
663
+ object of class `sentry`. If that object returns `true`, while
664
  converting to a value of type `bool`, the function endeavors to generate
665
  the requested output. If an exception is thrown during output, then
666
+ `ios_base::badbit` is set[^34]
667
+
668
+ in `*this`’s error state. If `(exceptions() & badbit) != 0` then the
669
+ exception is rethrown. In any case, the unformatted output function ends
670
+ by destroying the `sentry` object, then, if no exception was thrown,
671
+ returning the value specified for the unformatted output function.
672
 
673
  ``` cpp
674
+ basic_ostream& put(char_type c);
675
  ```
676
 
677
  *Effects:* Behaves as an unformatted output function (as described
678
+ above). After constructing a `sentry` object, inserts the character `c`,
679
+ if possible.[^35]
680
 
681
  Otherwise, calls `setstate(badbit)` (which may throw `ios_base::failure`
682
  [[iostate.flags]]).
683
 
684
  *Returns:* `*this`.
 
686
  ``` cpp
687
  basic_ostream& write(const char_type* s, streamsize n);
688
  ```
689
 
690
  *Effects:* Behaves as an unformatted output function (as described
691
+ above). After constructing a `sentry` object, obtains characters to
692
+ insert from successive locations of an array whose first element is
693
+ designated by `s`.[^36]
694
+
695
+ Characters are inserted until either of the following occurs:
696
 
697
  - `n` characters are inserted;
698
  - inserting in the output sequence fails (in which case the function
699
  calls `setstate(badbit)`, which may throw `ios_base::failure`
700
  [[iostate.flags]]).
 
704
  ``` cpp
705
  basic_ostream& flush();
706
  ```
707
 
708
  *Effects:* Behaves as an unformatted output function (as described
709
+ above). If `rdbuf()` is not a null pointer, constructs a `sentry`
710
+ object. If that object returns `true` when converted to a value of type
711
+ `bool` the function calls `rdbuf()->pubsync()`. If that function returns
712
+ -1 calls `setstate(badbit)` (which may throw `ios_base::failure`
713
+ [[iostate.flags]]). Otherwise, if the `sentry` object returns `false`,
714
  does nothing.
715
 
716
  *Returns:* `*this`.
717
 
718
  #### Standard manipulators <a id="ostream.manip">[[ostream.manip]]</a>
 
782
  basic_ostream<charT, traits>& flush_emit(basic_ostream<charT, traits>& os);
783
  ```
784
 
785
  *Effects:* Calls `os.flush()`. Then, if `os.rdbuf()` is a
786
  `basic_syncbuf<charT, traits, Allocator>*`, called `buf` for the purpose
787
+ of exposition, behaves as an unformatted output
788
+ function [[ostream.unformatted]] of `os`. After constructing a `sentry`
789
+ object, calls `buf->emit()`. If that call returns `false`, calls
790
+ `os.setstate(ios_base::badbit)`.
791
 
792
  *Returns:* `os`.
793
 
794
  #### Rvalue stream insertion <a id="ostream.rvalue">[[ostream.rvalue]]</a>
795