From Jason Turner

[input.streams]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp8olkz3a9/{from.md → to.md} +19 -19
tmp/tmp8olkz3a9/{from.md → to.md} RENAMED
@@ -185,11 +185,11 @@ values returned by `gcount()` and `rhs.gcount()`.
185
  ``` cpp
186
  namespace std {
187
  template <class charT,class traits = char_traits<charT> >
188
  class basic_istream<charT,traits>::sentry {
189
  typedef traits traits_type;
190
- bool ok_; // exposition onlyr
191
  public:
192
  explicit sentry(basic_istream<charT,traits>& is, bool noskipws = false);
193
  ~sentry();
194
  explicit operator bool() const { return ok_; }
195
  sentry(const sentry&) = delete;
@@ -203,19 +203,19 @@ exception safe prefix and suffix operations.
203
 
204
  ``` cpp
205
  explicit sentry(basic_istream<charT,traits>& is, bool noskipws = false);
206
  ```
207
 
208
- *Effects:* If `is.good()` is `false`, calls is.setstate(failbit).
209
  Otherwise, prepares for formatted or unformatted input. First, if
210
  `is.tie()` is not a null pointer, the function calls `is.tie()->flush()`
211
  to synchronize the output sequence with any associated external C
212
  stream. Except that this call can be suppressed if the put area of
213
  `is.tie()` is empty. Further an implementation is allowed to defer the
214
  call to `flush` until a call of `is.rdbuf()->underflow()` occurs. If no
215
  such call occurs before the `sentry` object is destroyed, the call to
216
- `flush` may be eliminated entirely.[^16] If `noskipws` is zero and
217
  `is.flags() & ios_base::skipws` is nonzero, the function extracts and
218
  discards each character as long as the next available input character
219
  `c` is a whitespace character. If `is.rdbuf()->sbumpc()` or
220
  `is.rdbuf()->sgetc()` returns `traits::eof()`, the function calls
221
  `setstate(failbit | eofbit)` (which may throw `ios_base::failure`).
@@ -235,11 +235,11 @@ if (ctype.is(ctype.space,c)!=0)
235
  ```
236
 
237
  If, after any preparation is completed, `is.good()` is `true`,
238
  `ok_ != false` otherwise, `ok_ == false`. During preparation, the
239
  constructor may call `setstate(failbit)` (which may throw
240
- `ios_base::failure` ([[iostate.flags]]))[^17]
241
 
242
  ``` cpp
243
  ~sentry();
244
  ```
245
 
@@ -257,11 +257,11 @@ explicit operator bool() const;
257
 
258
  Each formatted input function begins execution by constructing an object
259
  of class `sentry` with the `noskipws` (second) argument `false`. If the
260
  `sentry` object returns `true`, when converted to a value of type
261
  `bool`, the function endeavors to obtain the requested input. If an
262
- exception is thrown during input then `ios::badbit` is turned on[^18] in
263
  `*this`’s error state. If `(exceptions()&badbit) != 0` then the
264
  exception is rethrown. In any case, the formatted input function
265
  destroys the `sentry` object. If no exception has been thrown, it
266
  returns `*this`.
267
 
@@ -350,17 +350,17 @@ setstate(err);
350
 
351
  ##### `basic_istream::operator>>` <a id="istream::extractors">[[istream::extractors]]</a>
352
 
353
  ``` cpp
354
  basic_istream<charT,traits>& operator>>
355
- (basic_istream<charT,traits>& (*pf)(basic_istream<charT,traits>&))
356
  ```
357
 
358
  *Effects:* None. This extractor does not behave as a formatted input
359
  function (as described in  [[istream.formatted.reqmts]].)
360
 
361
- *Returns:* `pf(*this)`.[^19]
362
 
363
  ``` cpp
364
  basic_istream<charT,traits>& operator>>
365
  (basic_ios<charT,traits>& (*pf)(basic_ios<charT,traits>&));
366
  ```
@@ -374,11 +374,11 @@ in  [[istream.formatted.reqmts]]).
374
  ``` cpp
375
  basic_istream<charT,traits>& operator>>
376
  (ios_base& (*pf)(ios_base&));
377
  ```
378
 
379
- *Effects:* Calls `pf(*this)`.[^20] This extractor does not behave as a
380
  formatted input function (as described
381
  in  [[istream.formatted.reqmts]]).
382
 
383
  *Returns:* `*this`.
384
 
@@ -476,11 +476,11 @@ an exception or if the sentry object returns false, when converted to a
476
  value of type `bool`, the function returns without attempting to obtain
477
  any input. In either case the number of extracted characters is set to
478
  0; unformatted input functions taking a character array of non-zero size
479
  as an argument shall also store a null character (using `charT()`) in
480
  the first location of the array. If an exception is thrown during input
481
- then `ios::badbit` is turned on[^21] in `*this`’s error state.
482
  (Exceptions thrown from `basic_ios<>::clear()` are not caught or
483
  rethrown.) If `(exceptions()&badbit) != 0` then the exception is
484
  rethrown. It also counts the number of characters extracted. If no
485
  exception has been thrown it ends by storing the count in a member
486
  object and returning the value specified. In any event the `sentry`
@@ -513,11 +513,11 @@ basic_istream<charT,traits>& get(char_type& c);
513
  ```
514
 
515
  *Effects:* Behaves as an unformatted input function (as described
516
  in  [[istream.unformatted]], paragraph 1). After constructing a sentry
517
  object, extracts a character, if one is available, and assigns it to
518
- `c`.[^22] Otherwise, the function calls `setstate(failbit)` (which may
519
  throw `ios_base::failure` ([[iostate.flags]])).
520
 
521
  *Returns:* `*this`.
522
 
523
  ``` cpp
@@ -526,11 +526,11 @@ basic_istream<charT,traits>& get(char_type* s, streamsize n,
526
  ```
527
 
528
  *Effects:* Behaves as an unformatted input function (as described
529
  in  [[istream.unformatted]], paragraph 1). After constructing a sentry
530
  object, extracts characters and stores them into successive locations of
531
- an array whose first element is designated by `s`.[^23] Characters are
532
  extracted and stored until any of the following occurs:
533
 
534
  - `n` is less than one or `n - 1` characters are stored;
535
  - end-of-file occurs on the input sequence (in which case the function
536
  calls `setstate(eofbit)`);
@@ -543,11 +543,11 @@ if `n` is greater than zero it then stores a null character into the
543
  next successive location of the array.
544
 
545
  *Returns:* `*this`.
546
 
547
  ``` cpp
548
- basic_istream<charT,traits>& get(char_type* s, streamsize n)
549
  ```
550
 
551
  *Effects:* Calls `get(s,n,widen(’\n’))`
552
 
553
  *Returns:* Value returned by the call.
@@ -590,25 +590,25 @@ basic_istream<charT,traits>& getline(char_type* s, streamsize n,
590
  ```
591
 
592
  *Effects:* Behaves as an unformatted input function (as described
593
  in  [[istream.unformatted]], paragraph 1). After constructing a sentry
594
  object, extracts characters and stores them into successive locations of
595
- an array whose first element is designated by `s`.[^24] Characters are
596
  extracted and stored until one of the following occurs:
597
 
598
  1. end-of-file occurs on the input sequence (in which case the function
599
  calls `setstate(eofbit)`);
600
  2. `traits::eq(c, delim)` for the next available input character `c`
601
  (in which case the input character is extracted but not
602
- stored);[^25]
603
  3. `n` is less than one or `n - 1` characters are stored (in which case
604
  the function calls `setstate(failbit)`).
605
 
606
- These conditions are tested in the order shown.[^26]
607
 
608
  If the function extracts no characters, it calls `setstate(failbit)`
609
- (which may throw `ios_base::failure` ([[iostate.flags]])).[^27]
610
 
611
  In any case, if `n` is greater than zero, it then stores a null
612
  character (using `charT()`) into the next successive location of the
613
  array.
614
 
@@ -653,12 +653,12 @@ basic_istream<charT,traits>&
653
  *Effects:* Behaves as an unformatted input function (as described
654
  in  [[istream.unformatted]], paragraph 1). After constructing a sentry
655
  object, extracts characters and discards them. Characters are extracted
656
  until any of the following occurs:
657
 
658
- - if `n != numeric_limits<streamsize>::max()` ([[limits]]), `n`
659
- characters are extracted
660
  - end-of-file occurs on the input sequence (in which case the function
661
  calls `setstate(eofbit)`, which may throw
662
  `ios_base::failure` ([[iostate.flags]]));
663
  - `traits::eq_int_type(traits::to_int_type(c), delim)` for the next
664
  available input character `c` (in which case `c` is extracted).
@@ -686,11 +686,11 @@ basic_istream<charT,traits>& read(char_type* s, streamsize n);
686
  *Effects:* Behaves as an unformatted input function (as described
687
  in  [[istream.unformatted]], paragraph 1). After constructing a sentry
688
  object, if `!good()` calls `setstate(failbit)` which may throw an
689
  exception, and return. Otherwise extracts characters and stores them
690
  into successive locations of an array whose first element is designated
691
- by `s`.[^28] Characters are extracted and stored until either of the
692
  following occurs:
693
 
694
  - `n` characters are stored;
695
  - end-of-file occurs on the input sequence (in which case the function
696
  calls `setstate(failbit | eofbit)`, which may throw
 
185
  ``` cpp
186
  namespace std {
187
  template <class charT,class traits = char_traits<charT> >
188
  class basic_istream<charT,traits>::sentry {
189
  typedef traits traits_type;
190
+ bool ok_; // exposition only
191
  public:
192
  explicit sentry(basic_istream<charT,traits>& is, bool noskipws = false);
193
  ~sentry();
194
  explicit operator bool() const { return ok_; }
195
  sentry(const sentry&) = delete;
 
203
 
204
  ``` cpp
205
  explicit sentry(basic_istream<charT,traits>& is, bool noskipws = false);
206
  ```
207
 
208
+ *Effects:* If `is.good()` is `false`, calls `is.setstate(failbit)`.
209
  Otherwise, prepares for formatted or unformatted input. First, if
210
  `is.tie()` is not a null pointer, the function calls `is.tie()->flush()`
211
  to synchronize the output sequence with any associated external C
212
  stream. Except that this call can be suppressed if the put area of
213
  `is.tie()` is empty. Further an implementation is allowed to defer the
214
  call to `flush` until a call of `is.rdbuf()->underflow()` occurs. If no
215
  such call occurs before the `sentry` object is destroyed, the call to
216
+ `flush` may be eliminated entirely.[^17] If `noskipws` is zero and
217
  `is.flags() & ios_base::skipws` is nonzero, the function extracts and
218
  discards each character as long as the next available input character
219
  `c` is a whitespace character. If `is.rdbuf()->sbumpc()` or
220
  `is.rdbuf()->sgetc()` returns `traits::eof()`, the function calls
221
  `setstate(failbit | eofbit)` (which may throw `ios_base::failure`).
 
235
  ```
236
 
237
  If, after any preparation is completed, `is.good()` is `true`,
238
  `ok_ != false` otherwise, `ok_ == false`. During preparation, the
239
  constructor may call `setstate(failbit)` (which may throw
240
+ `ios_base::failure` ([[iostate.flags]]))[^18]
241
 
242
  ``` cpp
243
  ~sentry();
244
  ```
245
 
 
257
 
258
  Each formatted input function begins execution by constructing an object
259
  of class `sentry` with the `noskipws` (second) argument `false`. If the
260
  `sentry` object returns `true`, when converted to a value of type
261
  `bool`, the function endeavors to obtain the requested input. If an
262
+ exception is thrown during input then `ios::badbit` is turned on[^19] in
263
  `*this`’s error state. If `(exceptions()&badbit) != 0` then the
264
  exception is rethrown. In any case, the formatted input function
265
  destroys the `sentry` object. If no exception has been thrown, it
266
  returns `*this`.
267
 
 
350
 
351
  ##### `basic_istream::operator>>` <a id="istream::extractors">[[istream::extractors]]</a>
352
 
353
  ``` cpp
354
  basic_istream<charT,traits>& operator>>
355
+ (basic_istream<charT,traits>& (*pf)(basic_istream<charT,traits>&));
356
  ```
357
 
358
  *Effects:* None. This extractor does not behave as a formatted input
359
  function (as described in  [[istream.formatted.reqmts]].)
360
 
361
+ *Returns:* `pf(*this)`.[^20]
362
 
363
  ``` cpp
364
  basic_istream<charT,traits>& operator>>
365
  (basic_ios<charT,traits>& (*pf)(basic_ios<charT,traits>&));
366
  ```
 
374
  ``` cpp
375
  basic_istream<charT,traits>& operator>>
376
  (ios_base& (*pf)(ios_base&));
377
  ```
378
 
379
+ *Effects:* Calls `pf(*this)`.[^21] This extractor does not behave as a
380
  formatted input function (as described
381
  in  [[istream.formatted.reqmts]]).
382
 
383
  *Returns:* `*this`.
384
 
 
476
  value of type `bool`, the function returns without attempting to obtain
477
  any input. In either case the number of extracted characters is set to
478
  0; unformatted input functions taking a character array of non-zero size
479
  as an argument shall also store a null character (using `charT()`) in
480
  the first location of the array. If an exception is thrown during input
481
+ then `ios::badbit` is turned on[^22] in `*this`’s error state.
482
  (Exceptions thrown from `basic_ios<>::clear()` are not caught or
483
  rethrown.) If `(exceptions()&badbit) != 0` then the exception is
484
  rethrown. It also counts the number of characters extracted. If no
485
  exception has been thrown it ends by storing the count in a member
486
  object and returning the value specified. In any event the `sentry`
 
513
  ```
514
 
515
  *Effects:* Behaves as an unformatted input function (as described
516
  in  [[istream.unformatted]], paragraph 1). After constructing a sentry
517
  object, extracts a character, if one is available, and assigns it to
518
+ `c`.[^23] Otherwise, the function calls `setstate(failbit)` (which may
519
  throw `ios_base::failure` ([[iostate.flags]])).
520
 
521
  *Returns:* `*this`.
522
 
523
  ``` cpp
 
526
  ```
527
 
528
  *Effects:* Behaves as an unformatted input function (as described
529
  in  [[istream.unformatted]], paragraph 1). After constructing a sentry
530
  object, extracts characters and stores them into successive locations of
531
+ an array whose first element is designated by `s`.[^24] Characters are
532
  extracted and stored until any of the following occurs:
533
 
534
  - `n` is less than one or `n - 1` characters are stored;
535
  - end-of-file occurs on the input sequence (in which case the function
536
  calls `setstate(eofbit)`);
 
543
  next successive location of the array.
544
 
545
  *Returns:* `*this`.
546
 
547
  ``` cpp
548
+ basic_istream<charT,traits>& get(char_type* s, streamsize n);
549
  ```
550
 
551
  *Effects:* Calls `get(s,n,widen(’\n’))`
552
 
553
  *Returns:* Value returned by the call.
 
590
  ```
591
 
592
  *Effects:* Behaves as an unformatted input function (as described
593
  in  [[istream.unformatted]], paragraph 1). After constructing a sentry
594
  object, extracts characters and stores them into successive locations of
595
+ an array whose first element is designated by `s`.[^25] Characters are
596
  extracted and stored until one of the following occurs:
597
 
598
  1. end-of-file occurs on the input sequence (in which case the function
599
  calls `setstate(eofbit)`);
600
  2. `traits::eq(c, delim)` for the next available input character `c`
601
  (in which case the input character is extracted but not
602
+ stored);[^26]
603
  3. `n` is less than one or `n - 1` characters are stored (in which case
604
  the function calls `setstate(failbit)`).
605
 
606
+ These conditions are tested in the order shown.[^27]
607
 
608
  If the function extracts no characters, it calls `setstate(failbit)`
609
+ (which may throw `ios_base::failure` ([[iostate.flags]])).[^28]
610
 
611
  In any case, if `n` is greater than zero, it then stores a null
612
  character (using `charT()`) into the next successive location of the
613
  array.
614
 
 
653
  *Effects:* Behaves as an unformatted input function (as described
654
  in  [[istream.unformatted]], paragraph 1). After constructing a sentry
655
  object, extracts characters and discards them. Characters are extracted
656
  until any of the following occurs:
657
 
658
+ - `n != numeric_limits<streamsize>::max()` ([[limits]]) and `n`
659
+ characters have been extracted so far
660
  - end-of-file occurs on the input sequence (in which case the function
661
  calls `setstate(eofbit)`, which may throw
662
  `ios_base::failure` ([[iostate.flags]]));
663
  - `traits::eq_int_type(traits::to_int_type(c), delim)` for the next
664
  available input character `c` (in which case `c` is extracted).
 
686
  *Effects:* Behaves as an unformatted input function (as described
687
  in  [[istream.unformatted]], paragraph 1). After constructing a sentry
688
  object, if `!good()` calls `setstate(failbit)` which may throw an
689
  exception, and return. Otherwise extracts characters and stores them
690
  into successive locations of an array whose first element is designated
691
+ by `s`.[^29] Characters are extracted and stored until either of the
692
  following occurs:
693
 
694
  - `n` characters are stored;
695
  - end-of-file occurs on the input sequence (in which case the function
696
  calls `setstate(failbit | eofbit)`, which may throw