From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9001 invoked by alias); 30 Aug 2005 20:16:07 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 8981 invoked by uid 48); 30 Aug 2005 20:16:03 -0000 Date: Tue, 30 Aug 2005 20:21:00 -0000 Message-ID: <20050830201603.8980.qmail@sourceware.org> From: "chris at bubblescope dot net" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20050830125045.23633.relf@os2.ru> References: <20050830125045.23633.relf@os2.ru> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug libstdc++/23633] map::insert() invalidates reverse_iterators X-Bugzilla-Reason: CC X-SW-Source: 2005-08/txt/msg03505.txt.bz2 List-Id: ------- 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