tmp/tmpb8xx31db/{from.md → to.md}
RENAMED
|
@@ -1,14 +1,15 @@
|
|
| 1 |
##### Class `basic_istream::sentry` <a id="istream.sentry">[[istream.sentry]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
-
template<class charT, class traits
|
| 6 |
class basic_istream<charT, traits>::sentry {
|
| 7 |
bool ok_; // exposition only
|
|
|
|
| 8 |
public:
|
| 9 |
-
explicit sentry(basic_istream
|
| 10 |
~sentry();
|
| 11 |
explicit operator bool() const { return ok_; }
|
| 12 |
sentry(const sentry&) = delete;
|
| 13 |
sentry& operator=(const sentry&) = delete;
|
| 14 |
};
|
|
@@ -17,32 +18,34 @@ namespace std {
|
|
| 17 |
|
| 18 |
The class `sentry` defines a class that is responsible for doing
|
| 19 |
exception safe prefix and suffix operations.
|
| 20 |
|
| 21 |
``` cpp
|
| 22 |
-
explicit sentry(basic_istream
|
| 23 |
```
|
| 24 |
|
| 25 |
*Effects:* If `is.good()` is `false`, calls `is.setstate(failbit)`.
|
| 26 |
Otherwise, prepares for formatted or unformatted input. First, if
|
| 27 |
`is.tie()` is not a null pointer, the function calls `is.tie()->flush()`
|
| 28 |
to synchronize the output sequence with any associated external C
|
| 29 |
stream. Except that this call can be suppressed if the put area of
|
| 30 |
`is.tie()` is empty. Further an implementation is allowed to defer the
|
| 31 |
call to `flush` until a call of `is.rdbuf()->underflow()` occurs. If no
|
| 32 |
such call occurs before the `sentry` object is destroyed, the call to
|
| 33 |
-
`flush` may be eliminated entirely.[^18]
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
`
|
|
|
|
|
|
|
| 39 |
|
| 40 |
*Remarks:* The constructor
|
| 41 |
|
| 42 |
``` cpp
|
| 43 |
-
explicit sentry(basic_istream
|
| 44 |
```
|
| 45 |
|
| 46 |
uses the currently imbued locale in `is`, to determine whether the next
|
| 47 |
input character is whitespace or not.
|
| 48 |
|
|
|
|
| 1 |
##### Class `basic_istream::sentry` <a id="istream.sentry">[[istream.sentry]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
+
template<class charT, class traits>
|
| 6 |
class basic_istream<charT, traits>::sentry {
|
| 7 |
bool ok_; // exposition only
|
| 8 |
+
|
| 9 |
public:
|
| 10 |
+
explicit sentry(basic_istream& is, bool noskipws = false);
|
| 11 |
~sentry();
|
| 12 |
explicit operator bool() const { return ok_; }
|
| 13 |
sentry(const sentry&) = delete;
|
| 14 |
sentry& operator=(const sentry&) = delete;
|
| 15 |
};
|
|
|
|
| 18 |
|
| 19 |
The class `sentry` defines a class that is responsible for doing
|
| 20 |
exception safe prefix and suffix operations.
|
| 21 |
|
| 22 |
``` cpp
|
| 23 |
+
explicit sentry(basic_istream& is, bool noskipws = false);
|
| 24 |
```
|
| 25 |
|
| 26 |
*Effects:* If `is.good()` is `false`, calls `is.setstate(failbit)`.
|
| 27 |
Otherwise, prepares for formatted or unformatted input. First, if
|
| 28 |
`is.tie()` is not a null pointer, the function calls `is.tie()->flush()`
|
| 29 |
to synchronize the output sequence with any associated external C
|
| 30 |
stream. Except that this call can be suppressed if the put area of
|
| 31 |
`is.tie()` is empty. Further an implementation is allowed to defer the
|
| 32 |
call to `flush` until a call of `is.rdbuf()->underflow()` occurs. If no
|
| 33 |
such call occurs before the `sentry` object is destroyed, the call to
|
| 34 |
+
`flush` may be eliminated entirely.[^18]
|
| 35 |
+
|
| 36 |
+
If `noskipws` is zero and `is.flags() & ios_base::skipws` is nonzero,
|
| 37 |
+
the function extracts and discards each character as long as the next
|
| 38 |
+
available input character `c` is a whitespace character. If
|
| 39 |
+
`is.rdbuf()->sbumpc()` or `is.rdbuf()->sgetc()` returns `traits::eof()`,
|
| 40 |
+
the function calls `setstate(failbit | eofbit)` (which may throw
|
| 41 |
+
`ios_base::failure`).
|
| 42 |
|
| 43 |
*Remarks:* The constructor
|
| 44 |
|
| 45 |
``` cpp
|
| 46 |
+
explicit sentry(basic_istream& is, bool noskipws = false)
|
| 47 |
```
|
| 48 |
|
| 49 |
uses the currently imbued locale in `is`, to determine whether the next
|
| 50 |
input character is whitespace or not.
|
| 51 |
|