[Bug libstdc++/51881] istream_iterator copy leads to incorrect value read
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jan 17 13:21:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51881
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-01-17 13:10:15 UTC ---
Or for a better example, this is basically what your program tries to do:
foo f;
f.v = std::vector<int>(3);
while (ss >> f)
std::cout << f << '\n';
That shows the same problem.
Compare it with e.g.
std::string s = "0 0 0";
while (ss >> s)
std::cout << s << '\n';
which doesn't keep appending to the string.
More information about the Gcc-bugs
mailing list