[Bug libstdc++/39547] New: deque::erase invalidates end()
terra at gnome dot org
gcc-bugzilla@gcc.gnu.org
Tue Mar 24 17:05:00 GMT 2009
The program below should print nothing. For me, it prints "1".
When erasing at the beginning or the end of a deque, the only iterators
to be invalidated are those of elements being erased. All others, and
in particular end(), should remain valid. (I am fairly certain that the
standard didn't mean to keep end() valid, but that's what it says.)
#include <iostream>
#include <deque>
int
main ()
{
std::deque<int> d;
d.resize (1, 1);
std::deque<int>::iterator the_end = d.end ();
d.erase (d.begin (), the_end);
for (std::deque<int>::iterator i = d.begin ();
i != the_end;
++i)
std::cerr << *i << std::endl;
return 0;
}
--
Summary: deque::erase invalidates end()
Product: gcc
Version: 4.3.1
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: terra at gnome dot org
GCC target triplet: x86_64-suse-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39547
More information about the Gcc-bugs
mailing list