tmp/tmp99la761v/{from.md → to.md}
RENAMED
|
@@ -1,7 +1,14 @@
|
|
| 1 |
#### Class template `basic_istream` <a id="istream">[[istream]]</a>
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
template<class charT, class traits = char_traits<charT>>
|
| 6 |
class basic_istream : virtual public basic_ios<charT, traits> {
|
| 7 |
public:
|
|
@@ -18,64 +25,62 @@ namespace std {
|
|
| 18 |
|
| 19 |
// [istream.sentry], prefix/suffix
|
| 20 |
class sentry;
|
| 21 |
|
| 22 |
// [istream.formatted], formatted input
|
| 23 |
-
basic_istream
|
| 24 |
-
|
| 25 |
-
basic_istream
|
| 26 |
-
operator>>(basic_ios<charT, traits>& (*pf)(basic_ios<charT, traits>&));
|
| 27 |
-
basic_istream<charT, traits>&
|
| 28 |
-
operator>>(ios_base& (*pf)(ios_base&));
|
| 29 |
|
| 30 |
-
basic_istream
|
| 31 |
-
basic_istream
|
| 32 |
-
basic_istream
|
| 33 |
-
basic_istream
|
| 34 |
-
basic_istream
|
| 35 |
-
basic_istream
|
| 36 |
-
basic_istream
|
| 37 |
-
basic_istream
|
| 38 |
-
basic_istream
|
| 39 |
-
basic_istream
|
| 40 |
-
basic_istream
|
| 41 |
-
basic_istream
|
|
|
|
| 42 |
|
| 43 |
-
basic_istream
|
| 44 |
-
basic_istream
|
| 45 |
|
| 46 |
// [istream.unformatted], unformatted input
|
| 47 |
streamsize gcount() const;
|
| 48 |
int_type get();
|
| 49 |
-
basic_istream
|
| 50 |
-
basic_istream
|
| 51 |
-
basic_istream
|
| 52 |
-
basic_istream
|
| 53 |
-
basic_istream
|
| 54 |
|
| 55 |
-
basic_istream
|
| 56 |
-
basic_istream
|
| 57 |
|
| 58 |
-
basic_istream
|
| 59 |
int_type peek();
|
| 60 |
-
basic_istream
|
| 61 |
streamsize readsome(char_type* s, streamsize n);
|
| 62 |
|
| 63 |
-
basic_istream
|
| 64 |
-
basic_istream
|
| 65 |
int sync();
|
| 66 |
|
| 67 |
pos_type tellg();
|
| 68 |
-
basic_istream
|
| 69 |
-
basic_istream
|
| 70 |
|
| 71 |
protected:
|
| 72 |
// [istream.cons], copy/move constructor
|
| 73 |
basic_istream(const basic_istream&) = delete;
|
| 74 |
basic_istream(basic_istream&& rhs);
|
| 75 |
|
| 76 |
-
// [istream.assign],
|
| 77 |
basic_istream& operator=(const basic_istream&) = delete;
|
| 78 |
basic_istream& operator=(basic_istream&& rhs);
|
| 79 |
void swap(basic_istream& rhs);
|
| 80 |
};
|
| 81 |
|
|
@@ -104,22 +109,10 @@ Two groups of member function signatures share common properties: the
|
|
| 104 |
*formatted input functions* (or *extractors*) and the *unformatted input
|
| 105 |
functions.* Both groups of input functions are described as if they
|
| 106 |
obtain (or *extract*) input *characters* by calling `rdbuf()->sbumpc()`
|
| 107 |
or `rdbuf()->sgetc()`. They may use other public members of `istream`.
|
| 108 |
|
| 109 |
-
If `rdbuf()->sbumpc()` or `rdbuf()->sgetc()` returns `traits::eof()`,
|
| 110 |
-
then the input function, except as explicitly noted otherwise, completes
|
| 111 |
-
its actions and does `setstate(eofbit)`, which may throw
|
| 112 |
-
`ios_base::failure` [[iostate.flags]], before returning.
|
| 113 |
-
|
| 114 |
-
If one of these called functions throws an exception, then unless
|
| 115 |
-
explicitly noted otherwise, the input function sets `badbit` in the
|
| 116 |
-
error state. If `badbit` is set in `exceptions()`, the input function
|
| 117 |
-
rethrows the exception without completing its actions, otherwise it does
|
| 118 |
-
not throw anything and proceeds as if the called function had returned a
|
| 119 |
-
failure indication.
|
| 120 |
-
|
| 121 |
##### Constructors <a id="istream.cons">[[istream.cons]]</a>
|
| 122 |
|
| 123 |
``` cpp
|
| 124 |
explicit basic_istream(basic_streambuf<charT, traits>* sb);
|
| 125 |
```
|
|
@@ -162,15 +155,16 @@ values returned by `gcount()` and `rhs.gcount()`.
|
|
| 162 |
|
| 163 |
##### Class `basic_istream::sentry` <a id="istream.sentry">[[istream.sentry]]</a>
|
| 164 |
|
| 165 |
``` cpp
|
| 166 |
namespace std {
|
| 167 |
-
template<class charT, class traits
|
| 168 |
class basic_istream<charT, traits>::sentry {
|
| 169 |
bool ok_; // exposition only
|
|
|
|
| 170 |
public:
|
| 171 |
-
explicit sentry(basic_istream
|
| 172 |
~sentry();
|
| 173 |
explicit operator bool() const { return ok_; }
|
| 174 |
sentry(const sentry&) = delete;
|
| 175 |
sentry& operator=(const sentry&) = delete;
|
| 176 |
};
|
|
@@ -179,32 +173,34 @@ namespace std {
|
|
| 179 |
|
| 180 |
The class `sentry` defines a class that is responsible for doing
|
| 181 |
exception safe prefix and suffix operations.
|
| 182 |
|
| 183 |
``` cpp
|
| 184 |
-
explicit sentry(basic_istream
|
| 185 |
```
|
| 186 |
|
| 187 |
*Effects:* If `is.good()` is `false`, calls `is.setstate(failbit)`.
|
| 188 |
Otherwise, prepares for formatted or unformatted input. First, if
|
| 189 |
`is.tie()` is not a null pointer, the function calls `is.tie()->flush()`
|
| 190 |
to synchronize the output sequence with any associated external C
|
| 191 |
stream. Except that this call can be suppressed if the put area of
|
| 192 |
`is.tie()` is empty. Further an implementation is allowed to defer the
|
| 193 |
call to `flush` until a call of `is.rdbuf()->underflow()` occurs. If no
|
| 194 |
such call occurs before the `sentry` object is destroyed, the call to
|
| 195 |
-
`flush` may be eliminated entirely.[^18]
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
`
|
|
|
|
|
|
|
| 201 |
|
| 202 |
*Remarks:* The constructor
|
| 203 |
|
| 204 |
``` cpp
|
| 205 |
-
explicit sentry(basic_istream
|
| 206 |
```
|
| 207 |
|
| 208 |
uses the currently imbued locale in `is`, to determine whether the next
|
| 209 |
input character is whitespace or not.
|
| 210 |
|
|
|
|
| 1 |
#### Class template `basic_istream` <a id="istream">[[istream]]</a>
|
| 2 |
|
| 3 |
+
##### General <a id="istream.general">[[istream.general]]</a>
|
| 4 |
+
|
| 5 |
+
When a function is specified with a type placeholder of
|
| 6 |
+
`extended-floating-point-type`, the implementation provides overloads
|
| 7 |
+
for all cv-unqualified extended floating-point types
|
| 8 |
+
[[basic.fundamental]] in lieu of `extended-floating-{point-type}`.
|
| 9 |
+
|
| 10 |
``` cpp
|
| 11 |
namespace std {
|
| 12 |
template<class charT, class traits = char_traits<charT>>
|
| 13 |
class basic_istream : virtual public basic_ios<charT, traits> {
|
| 14 |
public:
|
|
|
|
| 25 |
|
| 26 |
// [istream.sentry], prefix/suffix
|
| 27 |
class sentry;
|
| 28 |
|
| 29 |
// [istream.formatted], formatted input
|
| 30 |
+
basic_istream& operator>>(basic_istream& (*pf)(basic_istream&));
|
| 31 |
+
basic_istream& operator>>(basic_ios<charT, traits>& (*pf)(basic_ios<charT, traits>&));
|
| 32 |
+
basic_istream& operator>>(ios_base& (*pf)(ios_base&));
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
+
basic_istream& operator>>(bool& n);
|
| 35 |
+
basic_istream& operator>>(short& n);
|
| 36 |
+
basic_istream& operator>>(unsigned short& n);
|
| 37 |
+
basic_istream& operator>>(int& n);
|
| 38 |
+
basic_istream& operator>>(unsigned int& n);
|
| 39 |
+
basic_istream& operator>>(long& n);
|
| 40 |
+
basic_istream& operator>>(unsigned long& n);
|
| 41 |
+
basic_istream& operator>>(long long& n);
|
| 42 |
+
basic_istream& operator>>(unsigned long long& n);
|
| 43 |
+
basic_istream& operator>>(float& f);
|
| 44 |
+
basic_istream& operator>>(double& f);
|
| 45 |
+
basic_istream& operator>>(long double& f);
|
| 46 |
+
basic_istream& operator>>(extended-floating-point-type& f);
|
| 47 |
|
| 48 |
+
basic_istream& operator>>(void*& p);
|
| 49 |
+
basic_istream& operator>>(basic_streambuf<char_type, traits>* sb);
|
| 50 |
|
| 51 |
// [istream.unformatted], unformatted input
|
| 52 |
streamsize gcount() const;
|
| 53 |
int_type get();
|
| 54 |
+
basic_istream& get(char_type& c);
|
| 55 |
+
basic_istream& get(char_type* s, streamsize n);
|
| 56 |
+
basic_istream& get(char_type* s, streamsize n, char_type delim);
|
| 57 |
+
basic_istream& get(basic_streambuf<char_type, traits>& sb);
|
| 58 |
+
basic_istream& get(basic_streambuf<char_type, traits>& sb, char_type delim);
|
| 59 |
|
| 60 |
+
basic_istream& getline(char_type* s, streamsize n);
|
| 61 |
+
basic_istream& getline(char_type* s, streamsize n, char_type delim);
|
| 62 |
|
| 63 |
+
basic_istream& ignore(streamsize n = 1, int_type delim = traits::eof());
|
| 64 |
int_type peek();
|
| 65 |
+
basic_istream& read (char_type* s, streamsize n);
|
| 66 |
streamsize readsome(char_type* s, streamsize n);
|
| 67 |
|
| 68 |
+
basic_istream& putback(char_type c);
|
| 69 |
+
basic_istream& unget();
|
| 70 |
int sync();
|
| 71 |
|
| 72 |
pos_type tellg();
|
| 73 |
+
basic_istream& seekg(pos_type);
|
| 74 |
+
basic_istream& seekg(off_type, ios_base::seekdir);
|
| 75 |
|
| 76 |
protected:
|
| 77 |
// [istream.cons], copy/move constructor
|
| 78 |
basic_istream(const basic_istream&) = delete;
|
| 79 |
basic_istream(basic_istream&& rhs);
|
| 80 |
|
| 81 |
+
// [istream.assign], assignment and swap
|
| 82 |
basic_istream& operator=(const basic_istream&) = delete;
|
| 83 |
basic_istream& operator=(basic_istream&& rhs);
|
| 84 |
void swap(basic_istream& rhs);
|
| 85 |
};
|
| 86 |
|
|
|
|
| 109 |
*formatted input functions* (or *extractors*) and the *unformatted input
|
| 110 |
functions.* Both groups of input functions are described as if they
|
| 111 |
obtain (or *extract*) input *characters* by calling `rdbuf()->sbumpc()`
|
| 112 |
or `rdbuf()->sgetc()`. They may use other public members of `istream`.
|
| 113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
##### Constructors <a id="istream.cons">[[istream.cons]]</a>
|
| 115 |
|
| 116 |
``` cpp
|
| 117 |
explicit basic_istream(basic_streambuf<charT, traits>* sb);
|
| 118 |
```
|
|
|
|
| 155 |
|
| 156 |
##### Class `basic_istream::sentry` <a id="istream.sentry">[[istream.sentry]]</a>
|
| 157 |
|
| 158 |
``` cpp
|
| 159 |
namespace std {
|
| 160 |
+
template<class charT, class traits>
|
| 161 |
class basic_istream<charT, traits>::sentry {
|
| 162 |
bool ok_; // exposition only
|
| 163 |
+
|
| 164 |
public:
|
| 165 |
+
explicit sentry(basic_istream& is, bool noskipws = false);
|
| 166 |
~sentry();
|
| 167 |
explicit operator bool() const { return ok_; }
|
| 168 |
sentry(const sentry&) = delete;
|
| 169 |
sentry& operator=(const sentry&) = delete;
|
| 170 |
};
|
|
|
|
| 173 |
|
| 174 |
The class `sentry` defines a class that is responsible for doing
|
| 175 |
exception safe prefix and suffix operations.
|
| 176 |
|
| 177 |
``` cpp
|
| 178 |
+
explicit sentry(basic_istream& is, bool noskipws = false);
|
| 179 |
```
|
| 180 |
|
| 181 |
*Effects:* If `is.good()` is `false`, calls `is.setstate(failbit)`.
|
| 182 |
Otherwise, prepares for formatted or unformatted input. First, if
|
| 183 |
`is.tie()` is not a null pointer, the function calls `is.tie()->flush()`
|
| 184 |
to synchronize the output sequence with any associated external C
|
| 185 |
stream. Except that this call can be suppressed if the put area of
|
| 186 |
`is.tie()` is empty. Further an implementation is allowed to defer the
|
| 187 |
call to `flush` until a call of `is.rdbuf()->underflow()` occurs. If no
|
| 188 |
such call occurs before the `sentry` object is destroyed, the call to
|
| 189 |
+
`flush` may be eliminated entirely.[^18]
|
| 190 |
+
|
| 191 |
+
If `noskipws` is zero and `is.flags() & ios_base::skipws` is nonzero,
|
| 192 |
+
the function extracts and discards each character as long as the next
|
| 193 |
+
available input character `c` is a whitespace character. If
|
| 194 |
+
`is.rdbuf()->sbumpc()` or `is.rdbuf()->sgetc()` returns `traits::eof()`,
|
| 195 |
+
the function calls `setstate(failbit | eofbit)` (which may throw
|
| 196 |
+
`ios_base::failure`).
|
| 197 |
|
| 198 |
*Remarks:* The constructor
|
| 199 |
|
| 200 |
``` cpp
|
| 201 |
+
explicit sentry(basic_istream& is, bool noskipws = false)
|
| 202 |
```
|
| 203 |
|
| 204 |
uses the currently imbued locale in `is`, to determine whether the next
|
| 205 |
input character is whitespace or not.
|
| 206 |
|