bad bug in map<>::insert
Phil Edwards
pedwards@disaster.jaj.com
Wed Nov 7 13:09:00 GMT 2001
On Wed, Nov 21, 2001 at 01:31:21AM +0000, Nathan Myers wrote:
> I have found what seems like a serious bug in the member
> std::map<>::insert(iterator, const value_type&). Passing a
> hint can cause the map to insert the value in the wrong place,
> silently violating the map's ordering invariant.
[...]
> gcc version 3.0.1
Testcase 23_containers/map_insert.cc checks this, and
http://gcc.gnu.org/onlinedocs/libstdc++/23_containers/howto.html#4 warns:
Note that GCC releases prior to 3.0.2 had a bug in the case with
hint == begin() for the map and set classes. You should not use a hint
argument in those releases.
This was fixed three months ago.
Phil
--
If ye love wealth greater than liberty, the tranquility of servitude greater
than the animating contest for freedom, go home and leave us in peace. We seek
not your counsel, nor your arms. Crouch down and lick the hand that feeds you;
and may posterity forget that ye were our countrymen. - Samuel Adams
More information about the Libstdc++
mailing list