This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/23633] map::insert() invalidates reverse_iterators


------- Additional Comments From chris at bubblescope dot net  2005-08-30 20:16 -------
Just so we are 100% clear on what is occuring (I realise it might not be obvious from my message)

M.rbegin() returns an iterator i =  std::reverse_iterator(M.end());

*i therefore returns *--(M.end()), which at first is the same as M.begin().

After we stick some more stuff into the container, then *i (which is still equal *--(M.end())) becomes 
something different, as more stuff has been pushed into the container.

This is exactly what the standard requires we do, it's just unfortunatly that reverse_iterator is a little fragile 
in the presence of changing containers.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23633


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]