stdcxx-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Travis Vitek (JIRA)" <j...@apache.org>
Subject [jira] Closed: (STDCXX-216) std::map::insert (iterator, pair) doesn't use hint properly
Date Thu, 14 Feb 2008 08:51:08 GMT

     [ https://issues.apache.org/jira/browse/STDCXX-216?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Travis Vitek closed STDCXX-216.
-------------------------------

    Resolution: Fixed

Verified in nightly testing.

> std::map::insert (iterator, pair) doesn't use hint properly
> -----------------------------------------------------------
>
>                 Key: STDCXX-216
>                 URL: https://issues.apache.org/jira/browse/STDCXX-216
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 23. Containers
>    Affects Versions: 4.1.2, 4.1.3, 4.1.4
>         Environment: all
>            Reporter: Martin Sebor
>            Assignee: Travis Vitek
>             Fix For: 4.2.1
>
>   Original Estimate: 8h
>          Time Spent: 9h
>  Remaining Estimate: 0h
>
> 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=100&thread=542
> ----------------------------------------------------------------------
> 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 always fails:
> iterator before = --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 = position;
> --before;
> I found the same problem in STL library with CPP Builder 5 as well as on Sun
> 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 is it
> fixed?
> Another point is: Accoring to the manual the iterator should point to the last
> 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 = 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 element
> before or after the new one is required, so it may need even more code changes
> 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é
> 										
> ----------------------------------------------------------------------
> 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 issue on it -- see
> http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-active.html#233). We'll look into it.
> Thanks
> Martin

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message