This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
re: insert_unique with hint bug
- To: Benjamin Kosnik <bkoz@cygnus.com>
- Subject: re: insert_unique with hint bug
- From: John Potter <jpotter@eagle.lhup.edu>
- Date: Fri, 25 Jun 1999 11:51:09 -0400 (EDT)
- cc: libstdc++@sourceware.cygnus.com
Just guessing from the line numbers, you are making the change to
insert_unique which would break it by allowing duplicates at the
beginning of tree. The second part is for insert_equal which
would fix it allowing insertion of a duplicate at the beginning
of tree.
Sorry for working with an old source and not being sure.
John
On Thu, 24 Jun 1999, Benjamin Kosnik wrote:
> This looks like a bug that is still present in SGI STL 3.20, and in
> current v-3 snapshots. Here's an updated version of your patch, which
> could also be applied to the egcs-1.1 (and later) sources.
>
> If it's ok with you, and nobody else has any objections, I'll check it in
> later today.
>
> -benjamin
>
>
> 1999-06-24 Benjamin Kosnik <bkoz@tintin.cygnus.com>
> John Potter <jpotter@eagle.lhup.edu>
>
> * stl/bits/stl_tree.h (insert_equal): Fix.
>
>
> Index: stl_tree.h
> ===================================================================
> RCS file: /cvs/libstdc++/libstdc++/stl/bits/stl_tree.h,v
> retrieving revision 1.9
> diff -c -p -r1.9 stl_tree.h
> *** stl_tree.h 1999/02/10 01:00:36 1.9
> --- stl_tree.h 1999/06/24 19:33:46
> *************** _Rb_tree<_Key, _Val, _KeyOfValue, _Compa
> *** 937,943 ****
> {
> if (__position._M_node == _M_header->_M_left) { // begin()
> if (size() > 0 &&
> ! _M_key_compare(_KeyOfValue()(__v), _S_key(__position._M_node)))
> return _M_insert(__position._M_node, __position._M_node, __v);
> // first argument just needs to be non-null
> else
> --- 937,943 ----
> {
> if (__position._M_node == _M_header->_M_left) { // begin()
> if (size() > 0 &&
> ! ! _M_key_compare(_S_key(__position._M_node), _KeyOfValue()(__v)))
> return _M_insert(__position._M_node, __position._M_node, __v);
> // first argument just needs to be non-null
> else
> *************** _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,
> *** 970,976 ****
> {
> if (__position._M_node == _M_header->_M_left) { // begin()
> if (size() > 0 &&
> ! _M_key_compare(_KeyOfValue()(__v), _S_key(__position._M_node)))
> return _M_insert(__position._M_node, __position._M_node, __v);
> // first argument just needs to be non-null
> else
> --- 970,976 ----
> {
> if (__position._M_node == _M_header->_M_left) { // begin()
> if (size() > 0 &&
> ! ! _M_key_compare(_S_key(__position._M_node), _KeyOfValue()(__v)))
> return _M_insert(__position._M_node, __position._M_node, __v);
> // first argument just needs to be non-null
> else
>
>