Created on 1998-09-29.00:00:00 last changed 171 months ago
Rationale:
The real issue here is whether or not these string input functions get their characters from a streambuf, rather than by calling an istream's member functions, a streambuf signals failure either by returning eof or by throwing an exception; there are no other possibilities. The proposed resolution makes it clear that these two functions do get characters from a streambuf.
[ CuraƧao: Nico agrees with proposed resolution. ]
[ Redmond: Made changes in proposed resolution. operator>> should be a formatted input function, not an unformatted input function. getline should not be required to set gcount, since there is no mechanism for gcount to be set except by one of basic_istream's member functions. ]
Proposed resolution:
In [string.io], paragraph 1, replace:
Effects: Begins by constructing a sentry object k as if k were constructed by typename basic_istream<charT,traits>::sentry k( is). If bool( k) is true, it calls str.erase() and then extracts characters from is and appends them to str as if by calling str.append(1, c). If is.width() is greater than zero, the maximum number n of characters appended is is.width(); otherwise n is str.max_size(). Characters are extracted and appended until any of the following occurs:
with:
Effects: Behaves as a formatted input function ([istream.formatted.reqmts]). After constructing a sentry object, if the sentry converts to true, calls str.erase() and then extracts characters from is and appends them to str as if by calling str.append(1,c). If is.width() is greater than zero, the maximum number n of characters appended is is.width(); otherwise n is str.max_size(). Characters are extracted and appended until any of the following occurs:
In [string.io], paragraph 6, replace
Effects: Begins by constructing a sentry object k as if by typename basic_istream<charT,traits>::sentry k( is, true). If bool( k) is true, it calls str.erase() and then extracts characters from is and appends them to str as if by calling str.append(1, c) until any of the following occurs:
with:
Effects: Behaves as an unformatted input function ([istream.unformatted]), except that it does not affect the value returned by subsequent calls to basic_istream<>::gcount(). After constructing a sentry object, if the sentry converts to true, calls str.erase() and then extracts characters from is and appends them to str as if by calling str.append(1,c) until any of the following occurs:
Operator >> and getline() for strings read until eof() in the input stream is true. However, this might never happen, if the stream can't read anymore without reaching EOF. So shouldn't it be changed into that it reads until !good() ?
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-10-21 18:28:33 | admin | set | messages: + msg211 |
2010-10-21 18:28:33 | admin | set | messages: + msg210 |
2010-10-21 18:28:33 | admin | set | messages: + msg209 |
2010-10-21 18:28:33 | admin | set | messages: + msg208 |
1998-09-29 00:00:00 | admin | create |