Return-Path: Delivered-To: apmail-incubator-stdcxx-dev-archive@www.apache.org Received: (qmail 65144 invoked from network); 28 Jun 2006 18:03:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 28 Jun 2006 18:03:10 -0000 Received: (qmail 35202 invoked by uid 500); 28 Jun 2006 18:03:10 -0000 Delivered-To: apmail-incubator-stdcxx-dev-archive@incubator.apache.org Received: (qmail 35179 invoked by uid 500); 28 Jun 2006 18:03:10 -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 35168 invoked by uid 99); 28 Jun 2006 18:03:10 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Jun 2006 11:03:10 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [209.237.227.198] (HELO brutus.apache.org) (209.237.227.198) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Jun 2006 11:03:09 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 63F207141F3 for ; Wed, 28 Jun 2006 18:01:33 +0000 (GMT) Message-ID: <6849006.1151517693406.JavaMail.jira@brutus> Date: Wed, 28 Jun 2006 18:01:33 +0000 (GMT+00:00) From: "Martin Sebor (JIRA)" To: stdcxx-dev@incubator.apache.org Subject: [jira] Created: (STDCXX-216) std::map::insert (iterator, pair) doesn't use hint properly MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N std::map::insert (iterator, pair) doesn't use hint properly ----------------------------------------------------------- Key: STDCXX-216 URL: http://issues.apache.org/jira/browse/STDCXX-216 Project: C++ Standard Library Type: Bug Components: 23. Containers =20 Versions: 4.1.2, 4.1.3 =20 Environment: all Reporter: Martin Sebor Moved from the Rogue Wave bug tracking database: ****Created By: sebor @ Mar 23, 2004 04:17:39 PM**** http://www.roguewave.com/developer/forum/OpenForumThread.cfm?forum=3D100&th= read=3D542 ---------------------------------------------------------------------- Topic:Error in map::insert ---------------------------------------------------------------------- map::insert( iterator, pair) does not work (11/06/2003 02:13 AM) ---------------------------------------------------------------------- I wanted to use the map::insert( iterator, pair) method to speed up things,= but my tests showed that it was slower than the simple insert. Debugging showed that the test for usability of the position iterator alway= s fails: iterator before =3D --position; if (_key_compare( before.first, (key) v) && _key_compare( (key) v, position.first)) .. Reason: 'before' and 'position' are equal, and (more simple term) a < b && b < a is always false. I guess it should read iterator before =3D position; --before; I found the same problem in STL library with CPP Builder 5 as well as on Su= n Solaris 8, Sun Workshop 6 update 1 C++ 5.2 Patch 109508-09. Has anybody found this error too? Or, can anyone tell me in which version i= s it fixed? Another point is: Accoring to the manual the iterator should point to the l= ast element smaller than the element to insert. If the code would be changed as suggested above, it would work if the iterator pointed to the next-greater element in the map ... To make it work as described, the code would have to be iterator after =3D position; ++after; if (_key_compare( position.first, (key) v) && _key_compare( (key) v, after.first)) .. But I did not check the following insert methode if a pointer to the elemen= t before or after the new one is required, so it may need even more code chan= ges or a change of the description... Hth anybody else too, and maybe sbd can tell me in versions this problem is= fixed? Thx in advance! Ren=C3=A9 =09=09=09=09=09=09=09=09=09=09 ---------------------------------------------------------------------- Re: map::insert( iterator, pair) does not work (11/17/2003 04:49 PM) ---------------------------------------------------------------------- We are not aware of this problem. The use of the hint argument by insert() = isn't clearly specified in the C++ standard (in fact, there is an open issu= e on it -- see http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-active.html#233). We'll look= into it. Thanks Martin --=20 This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira