bug in istringstream::str(string)
Gerd v. Egidy
egidy@deam.de
Sat Apr 1 00:00:00 GMT 2000
hi,
i think i found a bug in the istringstream::str(string) function.
if i run the following example with a libstdc++-2.90.7 i don't get the
expected result:
istringstream is;
string base="123";
int a,b;
is.str(base);
is >> a;
cerr << a << "\n"; // output is 123
is.str(base);
is >> b;
cerr << b << "\n"; // output is 1073784336 (or some other strange value)
the example works fine if i put a space at the end of the base-string ("123
") so that the istringstream never meets the eof-condition.
the example works fine with the old 2.90.6.1 release too.
i took a look at the source of the str(string) function in the
string-streambuf and haven't seen code to re-initialize the state of the
iostream, but just the string-streambuf. i am not very familiar with the
source and can't tell what to do or submit a patch.
regards,
gerd
More information about the Libstdc++
mailing list