tmp/tmpysxe2n79/{from.md → to.md}
RENAMED
|
@@ -4,30 +4,30 @@
|
|
| 4 |
namespace std {
|
| 5 |
template <class charT, class traits = char_traits<charT>>
|
| 6 |
class basic_istream : virtual public basic_ios<charT, traits> {
|
| 7 |
public:
|
| 8 |
// types (inherited from basic_ios ([ios])):
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
|
| 15 |
-
// [istream.cons]
|
| 16 |
explicit basic_istream(basic_streambuf<charT, traits>* sb);
|
| 17 |
virtual ~basic_istream();
|
| 18 |
|
| 19 |
-
// [istream::sentry]
|
| 20 |
class sentry;
|
| 21 |
|
| 22 |
-
// [istream.formatted]
|
| 23 |
-
basic_istream<charT,traits>&
|
| 24 |
-
basic_istream<charT,traits>& (*pf)(basic_istream<charT,traits>&));
|
| 25 |
-
basic_istream<charT,traits>&
|
| 26 |
-
|
| 27 |
-
basic_istream<charT,traits>&
|
| 28 |
-
ios_base& (*pf)(ios_base&));
|
| 29 |
|
| 30 |
basic_istream<charT, traits>& operator>>(bool& n);
|
| 31 |
basic_istream<charT, traits>& operator>>(short& n);
|
| 32 |
basic_istream<charT, traits>& operator>>(unsigned short& n);
|
| 33 |
basic_istream<charT, traits>& operator>>(int& n);
|
|
@@ -39,30 +39,25 @@ namespace std {
|
|
| 39 |
basic_istream<charT, traits>& operator>>(float& f);
|
| 40 |
basic_istream<charT, traits>& operator>>(double& f);
|
| 41 |
basic_istream<charT, traits>& operator>>(long double& f);
|
| 42 |
|
| 43 |
basic_istream<charT, traits>& operator>>(void*& p);
|
| 44 |
-
basic_istream<charT,traits>& operator>>(
|
| 45 |
-
basic_streambuf<char_type,traits>* sb);
|
| 46 |
|
| 47 |
-
// [istream.unformatted]
|
| 48 |
streamsize gcount() const;
|
| 49 |
int_type get();
|
| 50 |
basic_istream<charT, traits>& get(char_type& c);
|
| 51 |
basic_istream<charT, traits>& get(char_type* s, streamsize n);
|
| 52 |
-
basic_istream<charT,traits>& get(char_type* s, streamsize n,
|
| 53 |
-
char_type delim);
|
| 54 |
basic_istream<charT, traits>& get(basic_streambuf<char_type, traits>& sb);
|
| 55 |
-
basic_istream<charT,traits>& get(basic_streambuf<char_type,traits>& sb,
|
| 56 |
-
char_type delim);
|
| 57 |
|
| 58 |
basic_istream<charT, traits>& getline(char_type* s, streamsize n);
|
| 59 |
-
basic_istream<charT,traits>& getline(char_type* s, streamsize n,
|
| 60 |
-
char_type delim);
|
| 61 |
|
| 62 |
-
basic_istream<charT,traits>& ignore(
|
| 63 |
-
streamsize n = 1, int_type delim = traits::eof());
|
| 64 |
int_type peek();
|
| 65 |
basic_istream<charT, traits>& read (char_type* s, streamsize n);
|
| 66 |
streamsize readsome(char_type* s, streamsize n);
|
| 67 |
|
| 68 |
basic_istream<charT, traits>& putback(char_type c);
|
|
@@ -72,45 +67,40 @@ namespace std {
|
|
| 72 |
pos_type tellg();
|
| 73 |
basic_istream<charT, traits>& seekg(pos_type);
|
| 74 |
basic_istream<charT, traits>& seekg(off_type, ios_base::seekdir);
|
| 75 |
|
| 76 |
protected:
|
|
|
|
| 77 |
basic_istream(const basic_istream& rhs) = delete;
|
| 78 |
basic_istream(basic_istream&& rhs);
|
| 79 |
|
| 80 |
-
// [istream.assign]
|
| 81 |
basic_istream& operator=(const basic_istream& rhs) = delete;
|
| 82 |
basic_istream& operator=(basic_istream&& rhs);
|
| 83 |
void swap(basic_istream& rhs);
|
| 84 |
};
|
| 85 |
|
| 86 |
-
// [istream
|
| 87 |
template<class charT, class traits>
|
| 88 |
-
basic_istream<charT,traits>& operator>>(basic_istream<charT,traits>&,
|
| 89 |
-
charT&);
|
| 90 |
template<class traits>
|
| 91 |
-
basic_istream<char,traits>& operator>>(basic_istream<char,traits>&,
|
| 92 |
-
unsigned char&);
|
| 93 |
template<class traits>
|
| 94 |
-
basic_istream<char,traits>& operator>>(basic_istream<char,traits>&,
|
| 95 |
-
signed char&);
|
| 96 |
|
| 97 |
template<class charT, class traits>
|
| 98 |
-
basic_istream<charT,traits>& operator>>(basic_istream<charT,traits>&,
|
| 99 |
-
charT*);
|
| 100 |
template<class traits>
|
| 101 |
-
basic_istream<char,traits>& operator>>(basic_istream<char,traits>&,
|
| 102 |
-
unsigned char*);
|
| 103 |
template<class traits>
|
| 104 |
-
basic_istream<char,traits>& operator>>(basic_istream<char,traits>&,
|
| 105 |
-
signed char*);
|
| 106 |
}
|
| 107 |
```
|
| 108 |
|
| 109 |
-
The class `basic_istream` defines a number of member function
|
| 110 |
-
that assist in reading and interpreting input from sequences
|
| 111 |
-
by a stream buffer.
|
| 112 |
|
| 113 |
Two groups of member function signatures share common properties: the
|
| 114 |
*formatted input functions* (or *extractors*) and the *unformatted input
|
| 115 |
functions.* Both groups of input functions are described as if they
|
| 116 |
obtain (or *extract*) input *characters* by calling `rdbuf()->sbumpc()`
|
|
@@ -132,15 +122,15 @@ failure indication.
|
|
| 132 |
|
| 133 |
``` cpp
|
| 134 |
explicit basic_istream(basic_streambuf<charT, traits>* sb);
|
| 135 |
```
|
| 136 |
|
| 137 |
-
*Effects:* Constructs an object of class `basic_istream`,
|
| 138 |
-
|
| 139 |
`basic_ios::init(sb)` ([[basic.ios.cons]]).
|
| 140 |
|
| 141 |
-
`gcount() == 0`
|
| 142 |
|
| 143 |
``` cpp
|
| 144 |
basic_istream(basic_istream&& rhs);
|
| 145 |
```
|
| 146 |
|
|
@@ -161,11 +151,11 @@ virtual ~basic_istream();
|
|
| 161 |
|
| 162 |
``` cpp
|
| 163 |
basic_istream& operator=(basic_istream&& rhs);
|
| 164 |
```
|
| 165 |
|
| 166 |
-
*Effects:* `swap(rhs)
|
| 167 |
|
| 168 |
*Returns:* `*this`.
|
| 169 |
|
| 170 |
``` cpp
|
| 171 |
void swap(basic_istream& rhs);
|
|
@@ -178,11 +168,11 @@ values returned by `gcount()` and `rhs.gcount()`.
|
|
| 178 |
|
| 179 |
``` cpp
|
| 180 |
namespace std {
|
| 181 |
template <class charT, class traits = char_traits<charT>>
|
| 182 |
class basic_istream<charT, traits>::sentry {
|
| 183 |
-
|
| 184 |
bool ok_; // exposition only
|
| 185 |
public:
|
| 186 |
explicit sentry(basic_istream<charT, traits>& is, bool noskipws = false);
|
| 187 |
~sentry();
|
| 188 |
explicit operator bool() const { return ok_; }
|
|
@@ -205,19 +195,23 @@ Otherwise, prepares for formatted or unformatted input. First, if
|
|
| 205 |
to synchronize the output sequence with any associated external C
|
| 206 |
stream. Except that this call can be suppressed if the put area of
|
| 207 |
`is.tie()` is empty. Further an implementation is allowed to defer the
|
| 208 |
call to `flush` until a call of `is.rdbuf()->underflow()` occurs. If no
|
| 209 |
such call occurs before the `sentry` object is destroyed, the call to
|
| 210 |
-
`flush` may be eliminated entirely.[^
|
| 211 |
`is.flags() & ios_base::skipws` is nonzero, the function extracts and
|
| 212 |
discards each character as long as the next available input character
|
| 213 |
`c` is a whitespace character. If `is.rdbuf()->sbumpc()` or
|
| 214 |
`is.rdbuf()->sgetc()` returns `traits::eof()`, the function calls
|
| 215 |
`setstate(failbit | eofbit)` (which may throw `ios_base::failure`).
|
| 216 |
|
| 217 |
*Remarks:* The constructor
|
| 218 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 219 |
uses the currently imbued locale in `is`, to determine whether the next
|
| 220 |
input character is whitespace or not.
|
| 221 |
|
| 222 |
To decide if the character `c` is a whitespace character, the
|
| 223 |
constructor performs as if it executes the following code fragment:
|
|
@@ -229,11 +223,11 @@ if (ctype.is(ctype.space,c)!=0)
|
|
| 229 |
```
|
| 230 |
|
| 231 |
If, after any preparation is completed, `is.good()` is `true`,
|
| 232 |
`ok_ != false` otherwise, `ok_ == false`. During preparation, the
|
| 233 |
constructor may call `setstate(failbit)` (which may throw
|
| 234 |
-
`ios_base::failure` ([[iostate.flags]]))[^
|
| 235 |
|
| 236 |
``` cpp
|
| 237 |
~sentry();
|
| 238 |
```
|
| 239 |
|
|
|
|
| 4 |
namespace std {
|
| 5 |
template <class charT, class traits = char_traits<charT>>
|
| 6 |
class basic_istream : virtual public basic_ios<charT, traits> {
|
| 7 |
public:
|
| 8 |
// types (inherited from basic_ios ([ios])):
|
| 9 |
+
using char_type = charT;
|
| 10 |
+
using int_type = typename traits::int_type;
|
| 11 |
+
using pos_type = typename traits::pos_type;
|
| 12 |
+
using off_type = typename traits::off_type;
|
| 13 |
+
using traits_type = traits;
|
| 14 |
|
| 15 |
+
// [istream.cons], constructor/destructor
|
| 16 |
explicit basic_istream(basic_streambuf<charT, traits>* sb);
|
| 17 |
virtual ~basic_istream();
|
| 18 |
|
| 19 |
+
// [istream::sentry], prefix/suffix
|
| 20 |
class sentry;
|
| 21 |
|
| 22 |
+
// [istream.formatted], formatted input
|
| 23 |
+
basic_istream<charT, traits>&
|
| 24 |
+
operator>>(basic_istream<charT, traits>& (*pf)(basic_istream<charT, traits>&));
|
| 25 |
+
basic_istream<charT, traits>&
|
| 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<charT, traits>& operator>>(bool& n);
|
| 31 |
basic_istream<charT, traits>& operator>>(short& n);
|
| 32 |
basic_istream<charT, traits>& operator>>(unsigned short& n);
|
| 33 |
basic_istream<charT, traits>& operator>>(int& n);
|
|
|
|
| 39 |
basic_istream<charT, traits>& operator>>(float& f);
|
| 40 |
basic_istream<charT, traits>& operator>>(double& f);
|
| 41 |
basic_istream<charT, traits>& operator>>(long double& f);
|
| 42 |
|
| 43 |
basic_istream<charT, traits>& operator>>(void*& p);
|
| 44 |
+
basic_istream<charT, traits>& operator>>(basic_streambuf<char_type, traits>* sb);
|
|
|
|
| 45 |
|
| 46 |
+
// [istream.unformatted], unformatted input
|
| 47 |
streamsize gcount() const;
|
| 48 |
int_type get();
|
| 49 |
basic_istream<charT, traits>& get(char_type& c);
|
| 50 |
basic_istream<charT, traits>& get(char_type* s, streamsize n);
|
| 51 |
+
basic_istream<charT, traits>& get(char_type* s, streamsize n, char_type delim);
|
|
|
|
| 52 |
basic_istream<charT, traits>& get(basic_streambuf<char_type, traits>& sb);
|
| 53 |
+
basic_istream<charT, traits>& get(basic_streambuf<char_type, traits>& sb, char_type delim);
|
|
|
|
| 54 |
|
| 55 |
basic_istream<charT, traits>& getline(char_type* s, streamsize n);
|
| 56 |
+
basic_istream<charT, traits>& getline(char_type* s, streamsize n, char_type delim);
|
|
|
|
| 57 |
|
| 58 |
+
basic_istream<charT, traits>& ignore(streamsize n = 1, int_type delim = traits::eof());
|
|
|
|
| 59 |
int_type peek();
|
| 60 |
basic_istream<charT, traits>& read (char_type* s, streamsize n);
|
| 61 |
streamsize readsome(char_type* s, streamsize n);
|
| 62 |
|
| 63 |
basic_istream<charT, traits>& putback(char_type c);
|
|
|
|
| 67 |
pos_type tellg();
|
| 68 |
basic_istream<charT, traits>& seekg(pos_type);
|
| 69 |
basic_istream<charT, traits>& seekg(off_type, ios_base::seekdir);
|
| 70 |
|
| 71 |
protected:
|
| 72 |
+
// [istream.cons], copy/move constructor
|
| 73 |
basic_istream(const basic_istream& rhs) = delete;
|
| 74 |
basic_istream(basic_istream&& rhs);
|
| 75 |
|
| 76 |
+
// [istream.assign], assign and swap
|
| 77 |
basic_istream& operator=(const basic_istream& rhs) = delete;
|
| 78 |
basic_istream& operator=(basic_istream&& rhs);
|
| 79 |
void swap(basic_istream& rhs);
|
| 80 |
};
|
| 81 |
|
| 82 |
+
// [istream.extractors], character extraction templates
|
| 83 |
template<class charT, class traits>
|
| 84 |
+
basic_istream<charT, traits>& operator>>(basic_istream<charT, traits>&, charT&);
|
|
|
|
| 85 |
template<class traits>
|
| 86 |
+
basic_istream<char, traits>& operator>>(basic_istream<char, traits>&, unsigned char&);
|
|
|
|
| 87 |
template<class traits>
|
| 88 |
+
basic_istream<char, traits>& operator>>(basic_istream<char, traits>&, signed char&);
|
|
|
|
| 89 |
|
| 90 |
template<class charT, class traits>
|
| 91 |
+
basic_istream<charT, traits>& operator>>(basic_istream<charT, traits>&, charT*);
|
|
|
|
| 92 |
template<class traits>
|
| 93 |
+
basic_istream<char, traits>& operator>>(basic_istream<char, traits>&, unsigned char*);
|
|
|
|
| 94 |
template<class traits>
|
| 95 |
+
basic_istream<char, traits>& operator>>(basic_istream<char, traits>&, signed char*);
|
|
|
|
| 96 |
}
|
| 97 |
```
|
| 98 |
|
| 99 |
+
The class template `basic_istream` defines a number of member function
|
| 100 |
+
signatures that assist in reading and interpreting input from sequences
|
| 101 |
+
controlled by a stream buffer.
|
| 102 |
|
| 103 |
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()`
|
|
|
|
| 122 |
|
| 123 |
``` cpp
|
| 124 |
explicit basic_istream(basic_streambuf<charT, traits>* sb);
|
| 125 |
```
|
| 126 |
|
| 127 |
+
*Effects:* Constructs an object of class `basic_istream`, initializing
|
| 128 |
+
the base class subobject with
|
| 129 |
`basic_ios::init(sb)` ([[basic.ios.cons]]).
|
| 130 |
|
| 131 |
+
*Postconditions:* `gcount() == 0`.
|
| 132 |
|
| 133 |
``` cpp
|
| 134 |
basic_istream(basic_istream&& rhs);
|
| 135 |
```
|
| 136 |
|
|
|
|
| 151 |
|
| 152 |
``` cpp
|
| 153 |
basic_istream& operator=(basic_istream&& rhs);
|
| 154 |
```
|
| 155 |
|
| 156 |
+
*Effects:* As if by `swap(rhs)`.
|
| 157 |
|
| 158 |
*Returns:* `*this`.
|
| 159 |
|
| 160 |
``` cpp
|
| 161 |
void swap(basic_istream& rhs);
|
|
|
|
| 168 |
|
| 169 |
``` cpp
|
| 170 |
namespace std {
|
| 171 |
template <class charT, class traits = char_traits<charT>>
|
| 172 |
class basic_istream<charT, traits>::sentry {
|
| 173 |
+
using traits_type = traits;
|
| 174 |
bool ok_; // exposition only
|
| 175 |
public:
|
| 176 |
explicit sentry(basic_istream<charT, traits>& is, bool noskipws = false);
|
| 177 |
~sentry();
|
| 178 |
explicit operator bool() const { return ok_; }
|
|
|
|
| 195 |
to synchronize the output sequence with any associated external C
|
| 196 |
stream. Except that this call can be suppressed if the put area of
|
| 197 |
`is.tie()` is empty. Further an implementation is allowed to defer the
|
| 198 |
call to `flush` until a call of `is.rdbuf()->underflow()` occurs. If no
|
| 199 |
such call occurs before the `sentry` object is destroyed, the call to
|
| 200 |
+
`flush` may be eliminated entirely.[^18] If `noskipws` is zero and
|
| 201 |
`is.flags() & ios_base::skipws` is nonzero, the function extracts and
|
| 202 |
discards each character as long as the next available input character
|
| 203 |
`c` is a whitespace character. If `is.rdbuf()->sbumpc()` or
|
| 204 |
`is.rdbuf()->sgetc()` returns `traits::eof()`, the function calls
|
| 205 |
`setstate(failbit | eofbit)` (which may throw `ios_base::failure`).
|
| 206 |
|
| 207 |
*Remarks:* The constructor
|
| 208 |
+
|
| 209 |
+
``` cpp
|
| 210 |
+
explicit sentry(basic_istream<charT, traits>& is, bool noskipws = false)
|
| 211 |
+
```
|
| 212 |
+
|
| 213 |
uses the currently imbued locale in `is`, to determine whether the next
|
| 214 |
input character is whitespace or not.
|
| 215 |
|
| 216 |
To decide if the character `c` is a whitespace character, the
|
| 217 |
constructor performs as if it executes the following code fragment:
|
|
|
|
| 223 |
```
|
| 224 |
|
| 225 |
If, after any preparation is completed, `is.good()` is `true`,
|
| 226 |
`ok_ != false` otherwise, `ok_ == false`. During preparation, the
|
| 227 |
constructor may call `setstate(failbit)` (which may throw
|
| 228 |
+
`ios_base::failure` ([[iostate.flags]]))[^19]
|
| 229 |
|
| 230 |
``` cpp
|
| 231 |
~sentry();
|
| 232 |
```
|
| 233 |
|