This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of CD1 status.
Section: 220.127.116.11 [string.io] Status: CD1 Submitter: Martin Sebor Opened: 2006-06-22 Last modified: 2016-02-10
Priority: Not Prioritized
View all other issues in [string.io].
View all issues with CD1 status.
Section and paragraph numbers in this paper are relative to the working draft document number N2009 from 4/21/2006.
basic_string extractor in 18.104.22.168, p1 is clearly
required to behave as a formatted input function, as is the
std::getline() overload for string described in p7.
basic_string inserter described in p5 of the
same section has no such requirement. This has implications on how the
operator responds to exceptions thrown from
(formatted output functions are required to set
and swallow the exception unless
badbit is also set in
exceptions(); the string inserter doesn't have any such
I don't see anything in the spec for the string inserter that would justify requiring it to treat exceptions differently from all other similar operators. (If it did, I think it should be made this explicit by saying that the operator "does not behave as a formatted output function" as has been made customary by the adoption of the resolution of issue 60).
I propose to change the Effects clause in 22.214.171.124, p5, as follows:
Begins by constructing a sentry object k as if k were constructed by typename, then inserts the resulting sequence of characters
basic_ostream<charT, traits>::sentry k (os). If
seqas if by calling
os.rdbuf()->sputn(seq , n), where
nis the larger of
str.size(); then calls
If the call to sputn fails, calls
This proposed resilution assumes the resolution of issue 394 (i.e.,
that all formatted output functions are required to set
ios_base::badbit in response to any kind of streambuf
failure), and implicitly assumes that a return value of
sputn(seq, n) other than
indicates a failure.