bad bug in map<>::insert
Paolo Carlini
pcarlini@unitus.it
Wed Nov 7 08:48:00 GMT 2001
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.
>
> Do you agree this is a bug?
I agree with you. But the fact is, I'm *not* able to reproduce it with either 3.0.2 or 3.1 current...
A quick look at the ChangeLog reveal that the following patch was committed between 3.0.1 and 3.0.2:
2001-08-24 Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
Phil Edwards <pme@sources.redhat.com>
PR libstdc++/3349
* include/bits/stl_tree.h (insert_unique): Revert last change.
Values inserted at begin() must be less, not greater, than *begin()'s.
* testsuite/23_containers/map_insert.cc: New file.
Cheers,
Paolo.
More information about the Libstdc++
mailing list