Created on 2000-02-04.00:00:00 last changed 172 months ago
Proposed resolution:
Insert new paragraph after paragraph 2 in section [string.io]:
If the function extracts no characters, it calls is.setstate(ios::failbit) which may throw ios_base::failure (27.4.4.3).
The description of the stream extraction operator for std::string (section 21.3.7.9 [lib.string.io]) does not contain a requirement that failbit be set in the case that the operator fails to extract any characters from the input stream.
This implies that the typical construction
std::istream is; std::string str; ... while (is >> str) ... ;
(which tests failbit) is not required to terminate at EOF.
Furthermore, this is inconsistent with other extraction operators, which do include this requirement. (See sections [istream.formatted] and [istream.unformatted]), where this requirement is present, either explicitly or implicitly, for the extraction operators. It is also present explicitly in the description of getline (istream&, string&, charT) in section [string.io] paragraph 8.)
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-10-21 18:28:33 | admin | set | messages: + msg1870 |
2000-02-04 00:00:00 | admin | create |