This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/51881] istream_iterator copy leads to incorrect value read
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 17 Jan 2012 13:10:15 +0000
- Subject: [Bug libstdc++/51881] istream_iterator copy leads to incorrect value read
- Auto-submitted: auto-generated
- References: <bug-51881-4@http.gcc.gnu.org/bugzilla/>
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.