From stdcxx-dev-return-3944-apmail-incubator-stdcxx-dev-archive=incubator.apache.org@incubator.apache.org Mon Jul 09 19:26:24 2007 Return-Path: Delivered-To: apmail-incubator-stdcxx-dev-archive@www.apache.org Received: (qmail 7707 invoked from network); 9 Jul 2007 19:26:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Jul 2007 19:26:24 -0000 Received: (qmail 59917 invoked by uid 500); 9 Jul 2007 19:26:27 -0000 Delivered-To: apmail-incubator-stdcxx-dev-archive@incubator.apache.org Received: (qmail 59890 invoked by uid 500); 9 Jul 2007 19:26:27 -0000 Mailing-List: contact stdcxx-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-dev@incubator.apache.org Received: (qmail 59879 invoked by uid 99); 9 Jul 2007 19:26:27 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Jul 2007 12:26:27 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of Farid_Zaripov@epam.com designates 217.21.63.3 as permitted sender) Received: from [217.21.63.3] (HELO EPMSA009.epam.com) (217.21.63.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Jul 2007 12:26:23 -0700 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: 23.deque.special Date: Mon, 9 Jul 2007 22:26:01 +0300 Message-ID: <7BDB2168BEAEF14C98F1901FD2DE6438A6EA61@epmsa009.minsk.epam.com> In-Reply-To: <469286E9.1090208@roguewave.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: 23.deque.special Thread-Index: AcfCXDjC3l4eQZjzRjmdgxuA+ALZZQAAFZQg References: <7BDB2168BEAEF14C98F1901FD2DE6438A6E77F@epmsa009.minsk.epam.com> <4691BC19.8040407@roguewave.com> <7BDB2168BEAEF14C98F1901FD2DE6438A6EA46@epmsa009.minsk.epam.com> <46926AC3.9040301@roguewave.com> <7BDB2168BEAEF14C98F1901FD2DE6438A6EA5B@epmsa009.minsk.epam.com> <469286E9.1090208@roguewave.com> From: "Farid Zaripov" To: X-Virus-Checked: Checked by ClamAV on apache.org > -----Original Message----- > From: Martin Sebor [mailto:sebor@roguewave.com]=20 > Sent: Monday, July 09, 2007 10:05 PM > To: stdcxx-dev@incubator.apache.org > Subject: Re: 23.deque.special >=20 > > But in current implementation iterator not invalidated. Yes, it's=20 > > mebmers has changed, but it's still valid "end iterator". >=20 > But it doesn't point to the right container. Unless I'm still=20 > missing something this needs to pass: No. It point to the right container. std::deque x, y; x._C_end._C_node always =3D=3D &x._C_end._C_cur for empty container x This condition is required by current design (include/deque, line 663) void _C_init () { // clear both `beg.cur' and `end.cur' and set both `beg.node' // and `end.node' to point to `end.cur' (instead of 0) to avoid // having to check before dereferencing the pointers _C_beg =3D _C_end =3D _C_deque_iter (pointer (), &_C_end._C_cur); _C_nodes =3D _C_node_pointer (); _C_node_size =3D 0; } After x.swap (y) operation x._C_end._C_node still should point to &x._C_end._C_cur, but not to &y._C_end._C_cur to be a valid "end iterator" of the container x. > > If we decide to set deque<>._C_end._C_node =3D 0 for end=20 > iterator of=20 > > empty deque It would be a big change (we should change the=20 > all places=20 > > where _C_end._C_node member dereferenced). >=20 > Couldn't we just repoint _C_end._C_node in swap()? http://svn.apache.org/viewvc?view=3Drev&revision=3D507940 Here I repoint _C_end._C_node to the value required by current design after binary _STD::swap (_C_end, __rhs._C_end); Farid.