How do I select a version of libstdc+ to link against?
David Aldrich
David.Aldrich@EMEA.NEC.COM
Thu Sep 22 11:31:00 GMT 2011
> And if you want to detect a failure to read a boolean (rather than simply EOF)
> follow the loop with:
> if (!iss.eof())
> cout << "fail" << endl;
>
> That should give the same behaviour with 4.1 and 4.4 for your test, and for
> the case where the stream fails because it contains a non-boolean value such
> as "true true x" or "true true fal"
>
> Testing !iss.eof() tells you that the loop exited for some reason other than
> reaching EOF, i.e. it couldn't convert the input to bool.
I'm sorry, but that is just giving the same problem as before. In the case that the input stream contains valid Booleans, after the last Boolean is read, eof() is not true. My understanding of the bug report that I referred to earlier, is that one must attempt to read past the end of the stream for eof() to return true, which won't happen in the normal case.
More information about the Libstdc++
mailing list