2001-06-27 19:09:53 +02:00
|
|
|
// RB tree implementation -*- C++ -*-
|
|
|
|
|
2007-03-03 11:29:14 +01:00
|
|
|
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
|
2006-01-03 14:19:23 +01:00
|
|
|
// Free Software Foundation, Inc.
|
2001-06-27 19:09:53 +02:00
|
|
|
//
|
|
|
|
// This file is part of the GNU ISO C++ Library. This library is free
|
|
|
|
// software; you can redistribute it and/or modify it under the
|
|
|
|
// terms of the GNU General Public License as published by the
|
|
|
|
// Free Software Foundation; either version 2, or (at your option)
|
|
|
|
// any later version.
|
|
|
|
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU General Public License along
|
|
|
|
// with this library; see the file COPYING. If not, write to the Free
|
2005-08-17 04:28:44 +02:00
|
|
|
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
2001-06-27 19:09:53 +02:00
|
|
|
// USA.
|
|
|
|
|
|
|
|
// As a special exception, you may use this file as part of a free software
|
|
|
|
// library without restriction. Specifically, if other files instantiate
|
|
|
|
// templates or use macros or inline functions from this file, or you compile
|
|
|
|
// this file and link it with other files to produce an executable, this
|
|
|
|
// file does not by itself cause the resulting executable to be covered by
|
|
|
|
// the GNU General Public License. This exception does not however
|
|
|
|
// invalidate any other reasons why the executable file might be covered by
|
|
|
|
// the GNU General Public License.
|
|
|
|
|
2000-10-05 13:27:02 +02:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Copyright (c) 1996,1997
|
|
|
|
* Silicon Graphics Computer Systems, Inc.
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, distribute and sell this software
|
|
|
|
* and its documentation for any purpose is hereby granted without fee,
|
|
|
|
* provided that the above copyright notice appear in all copies and
|
|
|
|
* that both that copyright notice and this permission notice appear
|
|
|
|
* in supporting documentation. Silicon Graphics makes no
|
|
|
|
* representations about the suitability of this software for any
|
|
|
|
* purpose. It is provided "as is" without express or implied warranty.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Copyright (c) 1994
|
|
|
|
* Hewlett-Packard Company
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, distribute and sell this software
|
|
|
|
* and its documentation for any purpose is hereby granted without fee,
|
|
|
|
* provided that the above copyright notice appear in all copies and
|
|
|
|
* that both that copyright notice and this permission notice appear
|
|
|
|
* in supporting documentation. Hewlett-Packard Company makes no
|
|
|
|
* representations about the suitability of this software for any
|
|
|
|
* purpose. It is provided "as is" without express or implied warranty.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
c_io_stdio.h: Correct grammar in comments.
2001-11-02 Phil Edwards <pme@gcc.gnu.org>
* config/io/c_io_stdio.h: Correct grammar in comments.
* docs/doxygen/Intro.3: Expand "top-level" man page.
* docs/doxygen/doxygroups.cc: New module definitions (comments).
* docs/doxygen/mainpage.doxy: Tweaks.
* docs/doxygen/run_doxygen: Update Doxygen version, massage man pages.
Add @file hooks so that headers are considered to be documented.
* include/bits/basic_ios.h, include/bits/basic_file.h,
include/bits/basic_string.h, include/bits/boost_concept_check.h,
include/bits/char_traits.h, include/bits/codecvt.h,
include/bits/concept_check.h, include/bits/cpp_type_traits.h,
include/bits/fpos.h, include/bits/gslice.h, include/bits/gslice_array.h,
include/bits/indirect_array.h, include/bits/ios_base.h,
include/bits/locale_facets.h, include/bits/localefwd.h,
include/bits/mask_array.h, include/bits/pthread_allocimpl.h,
include/bits/slice.h, include/bits/slice_array.h,
include/bits/std_algorithm.h, include/bits/std_bitset.h,
include/bits/std_complex.h, include/bits/std_deque.h,
include/bits/std_fstream.h, include/bits/std_functional.h,
include/bits/std_iomanip.h, include/bits/std_ios.h,
include/bits/std_iosfwd.h, include/bits/std_iostream.h,
include/bits/std_istream.h, include/bits/std_iterator.h,
include/bits/std_limits.h, include/bits/std_list.h,
include/bits/std_locale.h, include/bits/std_map.h,
include/bits/std_memory.h, include/bits/std_numeric.h,
include/bits/std_ostream.h, include/bits/std_queue.h,
include/bits/std_set.h, include/bits/std_sstream.h,
include/bits/std_stack.h, include/bits/std_streambuf.h,
include/bits/std_string.h, include/bits/std_utility.h,
include/bits/std_valarray.h, include/bits/std_vector.h,
include/bits/stl_algo.h, include/bits/stl_alloc.h,
include/bits/stl_bvector.h, include/bits/stl_construct.h,
include/bits/stl_deque.h, include/bits/stl_heap.h,
include/bits/stl_iterator.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_iterator_base_types.h, include/bits/stl_list.h,
include/bits/stl_map.h, include/bits/stl_multimap.h,
include/bits/stl_multiset.h, include/bits/stl_numeric.h,
include/bits/stl_pair.h, include/bits/stl_pthread_alloc.h,
include/bits/stl_queue.h, include/bits/stl_raw_storage_iter.h,
include/bits/stl_relops.h, include/bits/stl_set.h,
include/bits/stl_stack.h, include/bits/stl_tempbuf.h,
include/bits/stl_threads.h, include/bits/stl_tree.h,
include/bits/stl_uninitialized.h, include/bits/stl_vector.h,
include/bits/stream_iterator.h, include/bits/streambuf_iterator.h,
include/bits/stringfwd.h, include/bits/type_traits.h,
include/bits/valarray_array.h, include/bits/valarray_meta.h:
Add hooks, tweak comments only.
* include/bits/stl_algobase.h (swap, min, iter_swap): Also
document these functions.
* include/bits/stl_function.h: Tweak link comments.
From-SVN: r46717
2001-11-02 18:38:11 +01:00
|
|
|
/** @file stl_tree.h
|
|
|
|
* This is an internal header file, included by other library headers.
|
|
|
|
* You should not attempt to use it directly.
|
2000-10-05 13:27:02 +02:00
|
|
|
*/
|
|
|
|
|
2007-06-18 19:22:53 +02:00
|
|
|
#ifndef _STL_TREE_H
|
|
|
|
#define _STL_TREE_H 1
|
2000-10-05 13:27:02 +02:00
|
|
|
|
|
|
|
#include <bits/stl_algobase.h>
|
2003-06-11 17:52:11 +02:00
|
|
|
#include <bits/allocator.h>
|
2000-10-05 13:27:02 +02:00
|
|
|
#include <bits/stl_function.h>
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
#include <bits/cpp_type_traits.h>
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2005-12-19 01:56:05 +01:00
|
|
|
_GLIBCXX_BEGIN_NAMESPACE(std)
|
|
|
|
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
// Red-black tree class, designed for use in implementing STL
|
|
|
|
// associative containers (set, multiset, map, and multimap). The
|
|
|
|
// insertion and deletion algorithms are based on those in Cormen,
|
|
|
|
// Leiserson, and Rivest, Introduction to Algorithms (MIT Press,
|
|
|
|
// 1990), except that
|
|
|
|
//
|
|
|
|
// (1) the header cell is maintained with links not only to the root
|
|
|
|
// but also to the leftmost node of the tree, to enable constant
|
|
|
|
// time begin(), and to the rightmost node of the tree, to enable
|
|
|
|
// linear time performance when used with the generic set algorithms
|
|
|
|
// (set_union, etc.)
|
|
|
|
//
|
|
|
|
// (2) when a node being deleted has two children its successor node
|
|
|
|
// is relinked into its place, rather than copied, so that the only
|
|
|
|
// iterators invalidated are those referring to the deleted node.
|
|
|
|
|
2003-05-07 07:01:59 +02:00
|
|
|
enum _Rb_tree_color { _S_red = false, _S_black = true };
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2002-03-07 07:53:23 +01:00
|
|
|
struct _Rb_tree_node_base
|
|
|
|
{
|
|
|
|
typedef _Rb_tree_node_base* _Base_ptr;
|
2003-07-30 17:01:58 +02:00
|
|
|
typedef const _Rb_tree_node_base* _Const_Base_ptr;
|
2004-02-08 05:46:42 +01:00
|
|
|
|
|
|
|
_Rb_tree_color _M_color;
|
|
|
|
_Base_ptr _M_parent;
|
|
|
|
_Base_ptr _M_left;
|
|
|
|
_Base_ptr _M_right;
|
|
|
|
|
|
|
|
static _Base_ptr
|
2002-03-07 07:53:23 +01:00
|
|
|
_S_minimum(_Base_ptr __x)
|
|
|
|
{
|
|
|
|
while (__x->_M_left != 0) __x = __x->_M_left;
|
|
|
|
return __x;
|
|
|
|
}
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2003-07-30 17:01:58 +02:00
|
|
|
static _Const_Base_ptr
|
|
|
|
_S_minimum(_Const_Base_ptr __x)
|
|
|
|
{
|
|
|
|
while (__x->_M_left != 0) __x = __x->_M_left;
|
|
|
|
return __x;
|
|
|
|
}
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
static _Base_ptr
|
2002-03-07 07:53:23 +01:00
|
|
|
_S_maximum(_Base_ptr __x)
|
|
|
|
{
|
|
|
|
while (__x->_M_right != 0) __x = __x->_M_right;
|
|
|
|
return __x;
|
|
|
|
}
|
2003-07-30 17:01:58 +02:00
|
|
|
|
|
|
|
static _Const_Base_ptr
|
|
|
|
_S_maximum(_Const_Base_ptr __x)
|
|
|
|
{
|
|
|
|
while (__x->_M_right != 0) __x = __x->_M_right;
|
|
|
|
return __x;
|
|
|
|
}
|
2002-03-07 07:53:23 +01:00
|
|
|
};
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2002-03-07 07:53:23 +01:00
|
|
|
template<typename _Val>
|
|
|
|
struct _Rb_tree_node : public _Rb_tree_node_base
|
|
|
|
{
|
|
|
|
typedef _Rb_tree_node<_Val>* _Link_type;
|
|
|
|
_Val _M_value_field;
|
|
|
|
};
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2003-07-30 17:01:58 +02:00
|
|
|
_Rb_tree_node_base*
|
|
|
|
_Rb_tree_increment(_Rb_tree_node_base* __x);
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-01-07 21:55:06 +01:00
|
|
|
const _Rb_tree_node_base*
|
|
|
|
_Rb_tree_increment(const _Rb_tree_node_base* __x);
|
|
|
|
|
2003-07-30 17:01:58 +02:00
|
|
|
_Rb_tree_node_base*
|
|
|
|
_Rb_tree_decrement(_Rb_tree_node_base* __x);
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-01-07 21:55:06 +01:00
|
|
|
const _Rb_tree_node_base*
|
|
|
|
_Rb_tree_decrement(const _Rb_tree_node_base* __x);
|
|
|
|
|
|
|
|
template<typename _Tp>
|
2003-07-30 17:01:58 +02:00
|
|
|
struct _Rb_tree_iterator
|
2002-03-07 07:53:23 +01:00
|
|
|
{
|
2004-01-07 21:55:06 +01:00
|
|
|
typedef _Tp value_type;
|
|
|
|
typedef _Tp& reference;
|
|
|
|
typedef _Tp* pointer;
|
|
|
|
|
2003-07-30 17:01:58 +02:00
|
|
|
typedef bidirectional_iterator_tag iterator_category;
|
2004-01-07 21:55:06 +01:00
|
|
|
typedef ptrdiff_t difference_type;
|
|
|
|
|
|
|
|
typedef _Rb_tree_iterator<_Tp> _Self;
|
|
|
|
typedef _Rb_tree_node_base::_Base_ptr _Base_ptr;
|
|
|
|
typedef _Rb_tree_node<_Tp>* _Link_type;
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2005-01-21 02:23:28 +01:00
|
|
|
_Rb_tree_iterator()
|
|
|
|
: _M_node() { }
|
2003-07-30 17:01:58 +02:00
|
|
|
|
2005-09-11 11:48:41 +02:00
|
|
|
explicit
|
2003-07-30 17:01:58 +02:00
|
|
|
_Rb_tree_iterator(_Link_type __x)
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
: _M_node(__x) { }
|
2003-07-30 17:01:58 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
reference
|
2003-07-30 17:01:58 +02:00
|
|
|
operator*() const
|
|
|
|
{ return static_cast<_Link_type>(_M_node)->_M_value_field; }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
pointer
|
2003-07-30 17:01:58 +02:00
|
|
|
operator->() const
|
|
|
|
{ return &static_cast<_Link_type>(_M_node)->_M_value_field; }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
_Self&
|
|
|
|
operator++()
|
|
|
|
{
|
2003-07-30 17:01:58 +02:00
|
|
|
_M_node = _Rb_tree_increment(_M_node);
|
2004-02-08 05:46:42 +01:00
|
|
|
return *this;
|
2002-03-07 07:53:23 +01:00
|
|
|
}
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
_Self
|
|
|
|
operator++(int)
|
2002-03-07 07:53:23 +01:00
|
|
|
{
|
|
|
|
_Self __tmp = *this;
|
2003-07-30 17:01:58 +02:00
|
|
|
_M_node = _Rb_tree_increment(_M_node);
|
2002-03-07 07:53:23 +01:00
|
|
|
return __tmp;
|
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
|
|
|
_Self&
|
2003-07-30 17:01:58 +02:00
|
|
|
operator--()
|
|
|
|
{
|
|
|
|
_M_node = _Rb_tree_decrement(_M_node);
|
|
|
|
return *this;
|
|
|
|
}
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
_Self
|
|
|
|
operator--(int)
|
2002-03-07 07:53:23 +01:00
|
|
|
{
|
|
|
|
_Self __tmp = *this;
|
2003-07-30 17:01:58 +02:00
|
|
|
_M_node = _Rb_tree_decrement(_M_node);
|
2002-03-07 07:53:23 +01:00
|
|
|
return __tmp;
|
|
|
|
}
|
2003-07-30 17:01:58 +02:00
|
|
|
|
2004-01-07 21:55:06 +01:00
|
|
|
bool
|
|
|
|
operator==(const _Self& __x) const
|
|
|
|
{ return _M_node == __x._M_node; }
|
|
|
|
|
|
|
|
bool
|
|
|
|
operator!=(const _Self& __x) const
|
|
|
|
{ return _M_node != __x._M_node; }
|
|
|
|
|
2003-07-30 17:01:58 +02:00
|
|
|
_Base_ptr _M_node;
|
2002-03-07 07:53:23 +01:00
|
|
|
};
|
|
|
|
|
2004-01-07 21:55:06 +01:00
|
|
|
template<typename _Tp>
|
|
|
|
struct _Rb_tree_const_iterator
|
|
|
|
{
|
|
|
|
typedef _Tp value_type;
|
|
|
|
typedef const _Tp& reference;
|
|
|
|
typedef const _Tp* pointer;
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-01-07 21:55:06 +01:00
|
|
|
typedef _Rb_tree_iterator<_Tp> iterator;
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-01-07 21:55:06 +01:00
|
|
|
typedef bidirectional_iterator_tag iterator_category;
|
|
|
|
typedef ptrdiff_t difference_type;
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-01-07 21:55:06 +01:00
|
|
|
typedef _Rb_tree_const_iterator<_Tp> _Self;
|
|
|
|
typedef _Rb_tree_node_base::_Const_Base_ptr _Base_ptr;
|
|
|
|
typedef const _Rb_tree_node<_Tp>* _Link_type;
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2005-01-21 02:23:28 +01:00
|
|
|
_Rb_tree_const_iterator()
|
|
|
|
: _M_node() { }
|
2004-01-07 21:55:06 +01:00
|
|
|
|
2005-09-11 11:48:41 +02:00
|
|
|
explicit
|
2004-01-07 21:55:06 +01:00
|
|
|
_Rb_tree_const_iterator(_Link_type __x)
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
: _M_node(__x) { }
|
2004-01-07 21:55:06 +01:00
|
|
|
|
|
|
|
_Rb_tree_const_iterator(const iterator& __it)
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
: _M_node(__it._M_node) { }
|
2004-01-07 21:55:06 +01:00
|
|
|
|
|
|
|
reference
|
|
|
|
operator*() const
|
|
|
|
{ return static_cast<_Link_type>(_M_node)->_M_value_field; }
|
|
|
|
|
|
|
|
pointer
|
|
|
|
operator->() const
|
|
|
|
{ return &static_cast<_Link_type>(_M_node)->_M_value_field; }
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
_Self&
|
|
|
|
operator++()
|
|
|
|
{
|
2004-01-07 21:55:06 +01:00
|
|
|
_M_node = _Rb_tree_increment(_M_node);
|
2004-02-08 05:46:42 +01:00
|
|
|
return *this;
|
2004-01-07 21:55:06 +01:00
|
|
|
}
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
_Self
|
|
|
|
operator++(int)
|
2004-01-07 21:55:06 +01:00
|
|
|
{
|
|
|
|
_Self __tmp = *this;
|
|
|
|
_M_node = _Rb_tree_increment(_M_node);
|
|
|
|
return __tmp;
|
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
|
|
|
_Self&
|
2004-01-07 21:55:06 +01:00
|
|
|
operator--()
|
|
|
|
{
|
|
|
|
_M_node = _Rb_tree_decrement(_M_node);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
_Self
|
|
|
|
operator--(int)
|
2004-01-07 21:55:06 +01:00
|
|
|
{
|
|
|
|
_Self __tmp = *this;
|
|
|
|
_M_node = _Rb_tree_decrement(_M_node);
|
|
|
|
return __tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
operator==(const _Self& __x) const
|
|
|
|
{ return _M_node == __x._M_node; }
|
|
|
|
|
|
|
|
bool
|
|
|
|
operator!=(const _Self& __x) const
|
|
|
|
{ return _M_node != __x._M_node; }
|
|
|
|
|
|
|
|
_Base_ptr _M_node;
|
2004-02-02 00:19:55 +01:00
|
|
|
};
|
2002-03-07 07:53:23 +01:00
|
|
|
|
|
|
|
template<typename _Val>
|
2004-02-08 05:46:42 +01:00
|
|
|
inline bool
|
2004-01-07 21:55:06 +01:00
|
|
|
operator==(const _Rb_tree_iterator<_Val>& __x,
|
2004-02-08 05:46:42 +01:00
|
|
|
const _Rb_tree_const_iterator<_Val>& __y)
|
2004-01-07 21:55:06 +01:00
|
|
|
{ return __x._M_node == __y._M_node; }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
|
|
|
template<typename _Val>
|
2004-02-08 05:46:42 +01:00
|
|
|
inline bool
|
2004-01-07 21:55:06 +01:00
|
|
|
operator!=(const _Rb_tree_iterator<_Val>& __x,
|
2004-02-08 05:46:42 +01:00
|
|
|
const _Rb_tree_const_iterator<_Val>& __y)
|
2002-03-07 07:53:23 +01:00
|
|
|
{ return __x._M_node != __y._M_node; }
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
void
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
_Rb_tree_insert_and_rebalance(const bool __insert_left,
|
2004-01-07 21:55:06 +01:00
|
|
|
_Rb_tree_node_base* __x,
|
|
|
|
_Rb_tree_node_base* __p,
|
|
|
|
_Rb_tree_node_base& __header);
|
2003-07-09 22:58:32 +02:00
|
|
|
|
|
|
|
_Rb_tree_node_base*
|
2004-02-08 05:46:42 +01:00
|
|
|
_Rb_tree_rebalance_for_erase(_Rb_tree_node_base* const __z,
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
_Rb_tree_node_base& __header);
|
2002-03-07 07:53:23 +01:00
|
|
|
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
2002-03-07 07:53:23 +01:00
|
|
|
typename _Compare, typename _Alloc = allocator<_Val> >
|
2003-12-23 01:09:26 +01:00
|
|
|
class _Rb_tree
|
2002-03-07 07:53:23 +01:00
|
|
|
{
|
2003-12-23 01:09:26 +01:00
|
|
|
typedef typename _Alloc::template rebind<_Rb_tree_node<_Val> >::other
|
|
|
|
_Node_allocator;
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2002-03-07 07:53:23 +01:00
|
|
|
protected:
|
|
|
|
typedef _Rb_tree_node_base* _Base_ptr;
|
2003-07-30 17:01:58 +02:00
|
|
|
typedef const _Rb_tree_node_base* _Const_Base_ptr;
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2002-03-07 07:53:23 +01:00
|
|
|
public:
|
|
|
|
typedef _Key key_type;
|
|
|
|
typedef _Val value_type;
|
|
|
|
typedef value_type* pointer;
|
|
|
|
typedef const value_type* const_pointer;
|
|
|
|
typedef value_type& reference;
|
|
|
|
typedef const value_type& const_reference;
|
2006-12-11 11:48:56 +01:00
|
|
|
typedef _Rb_tree_node<_Val>* _Link_type;
|
|
|
|
typedef const _Rb_tree_node<_Val>* _Const_Link_type;
|
2002-03-07 07:53:23 +01:00
|
|
|
typedef size_t size_type;
|
|
|
|
typedef ptrdiff_t difference_type;
|
2003-12-23 01:09:26 +01:00
|
|
|
typedef _Alloc allocator_type;
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
|
2006-01-03 14:19:23 +01:00
|
|
|
_Node_allocator&
|
|
|
|
_M_get_Node_allocator()
|
|
|
|
{ return *static_cast<_Node_allocator*>(&this->_M_impl); }
|
|
|
|
|
|
|
|
const _Node_allocator&
|
|
|
|
_M_get_Node_allocator() const
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
{ return *static_cast<const _Node_allocator*>(&this->_M_impl); }
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2006-01-03 14:19:23 +01:00
|
|
|
allocator_type
|
|
|
|
get_allocator() const
|
|
|
|
{ return allocator_type(_M_get_Node_allocator()); }
|
|
|
|
|
2002-03-07 07:53:23 +01:00
|
|
|
protected:
|
2006-12-11 11:48:56 +01:00
|
|
|
_Link_type
|
2004-02-01 12:25:21 +01:00
|
|
|
_M_get_node()
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
{ return _M_impl._Node_allocator::allocate(1); }
|
2003-12-23 01:09:26 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
void
|
2006-12-11 11:48:56 +01:00
|
|
|
_M_put_node(_Link_type __p)
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
{ _M_impl._Node_allocator::deallocate(__p, 1); }
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2002-03-07 07:53:23 +01:00
|
|
|
_Link_type
|
|
|
|
_M_create_node(const value_type& __x)
|
|
|
|
{
|
2003-12-23 01:09:26 +01:00
|
|
|
_Link_type __tmp = _M_get_node();
|
2004-02-08 05:46:42 +01:00
|
|
|
try
|
2004-07-28 18:37:20 +02:00
|
|
|
{ get_allocator().construct(&__tmp->_M_value_field, __x); }
|
2002-03-07 07:53:23 +01:00
|
|
|
catch(...)
|
|
|
|
{
|
2004-02-01 12:25:21 +01:00
|
|
|
_M_put_node(__tmp);
|
2004-02-08 05:46:42 +01:00
|
|
|
__throw_exception_again;
|
2002-03-07 07:53:23 +01:00
|
|
|
}
|
|
|
|
return __tmp;
|
2000-10-05 13:27:02 +02:00
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
|
|
|
_Link_type
|
2003-07-30 17:01:58 +02:00
|
|
|
_M_clone_node(_Const_Link_type __x)
|
2002-03-07 07:53:23 +01:00
|
|
|
{
|
|
|
|
_Link_type __tmp = _M_create_node(__x->_M_value_field);
|
|
|
|
__tmp->_M_color = __x->_M_color;
|
|
|
|
__tmp->_M_left = 0;
|
|
|
|
__tmp->_M_right = 0;
|
|
|
|
return __tmp;
|
2000-10-05 13:27:02 +02:00
|
|
|
}
|
2002-03-07 07:53:23 +01:00
|
|
|
|
|
|
|
void
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
_M_destroy_node(_Link_type __p)
|
2002-03-07 07:53:23 +01:00
|
|
|
{
|
2004-07-28 18:37:20 +02:00
|
|
|
get_allocator().destroy(&__p->_M_value_field);
|
2002-03-07 07:53:23 +01:00
|
|
|
_M_put_node(__p);
|
|
|
|
}
|
|
|
|
|
2003-12-23 01:09:26 +01:00
|
|
|
protected:
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
template<typename _Key_compare,
|
re PR c++/26099 (support for type traits is not available)
gcc/
2007-03-30 Paolo Carlini <pcarlini@suse.de>
PR c++/26099
* c-common.h (enum rid): Add RID_HAS_NOTHROW_ASSIGN,
RID_HAS_NOTHROW_CONSTRUCTOR, RID_HAS_NOTHROW_COPY,
RID_HAS_TRIVIAL_ASSIGN, RID_HAS_TRIVIAL_CONSTRUCTOR,
RID_HAS_TRIVIAL_COPY, RID_HAS_TRIVIAL_DESTRUCTOR,
RID_HAS_VIRTUAL_DESTRUCTOR, RID_IS_ABSTRACT, RID_IS_BASE_OF,
RID_IS_CONVERTIBLE_TO, RID_IS_CLASS, RID_IS_EMPTY, RID_IS_ENUM,
RID_IS_POD, RID_IS_POLYMORPHIC, RID_IS_UNION, as
C++ extensions.
* doc/extend.texi (Extensions to the C++ Language): Add Type Traits.
gcc/cp/
2007-03-30 Paolo Carlini <pcarlini@suse.de>
PR c++/26099
* cp-tree.h (enum cp_trait_kind, struct tree_trait_expr,
TRAIT_EXPR_TYPE1, TRAIT_EXPR_TYPE2, TRAIT_EXPR_KIND): Add.
(enum cp_tree_node_structure_enum, union lang_tree_node): Update.
(CLASS_TYPE_NON_UNION_P): Add.
(struct lang_type_class): Add has_complex_dflt.
(TYPE_HAS_COMPLEX_DFLT, TYPE_HAS_TRIVIAL_DFLT): Add.
(locate_copy, locate_ctor, locate_dtor, finish_trait_expr): Declare.
* cp-tree.def: Add TRAIT_EXPR.
* cp-objcp-common.c (cp_tree_size): Add TRAIT_EXPR case.
* lex.c (struct resword): Add __has_nothrow_assign,
__has_nothrow_constructor, __has_nothrow_copy, __has_trivial_assign,
__has_trivial_constructor, __has_trivial_copy,
__has_trivial_destructor, __has_virtual_destructor, __is_abstract,
__is_base_of, __is_class, __is_convertible_to, __is_empty, __is_enum,
__is_pod, __is_polymorphic, __is_union.
* parser.c (cp_parser_primary_expression): Deal with the new RIDs.
(cp_parser_trait_expr): New.
* semantics.c (finish_trait_expr, trait_expr_value
classtype_has_nothrow_copy_or_assign_p): New.
* method.c (locate_copy, locate_ctor, locate_dtor): Do not define
as static.
* decl.c (cp_tree_node_structure): Add TRAIT_EXPR.
* class.c (check_bases, check_field_decl, check_bases_and_members):
Deal with TYPE_HAS_COMPLEX_DFLT (t) too.
* pt.c (uses_template_parms, tsubst_copy_and_build,
value_dependent_expression_p, type_dependent_expression_p): Deal with
TRAIT_EXPR.
* tree.c (cp_walk_subtrees): Deal with TRAIT_EXPR.
gcc/testsuite/
2007-03-30 Paolo Carlini <pcarlini@suse.de>
PR c++/26099
* g++.dg/ext/is_base_of.C: New.
* g++.dg/ext/has_virtual_destructor.C: New.
* g++.dg/ext/is_polymorphic.C: New.
* g++.dg/ext/is_base_of_diagnostic.C: New.
* g++.dg/ext/is_enum.C: New.
* g++.dg/ext/has_nothrow_assign.C: New.
* g++.dg/ext/has_nothrow_constructor.C: New.
* g++.dg/ext/is_empty.C: New.
* g++.dg/ext/has_trivial_copy.C: New.
* g++.dg/ext/has_trivial_assign.C: New.
* g++.dg/ext/is_abstract.C: New.
* g++.dg/ext/is_pod.C: New.
* g++.dg/ext/has_nothrow_copy.C: New.
* g++.dg/ext/is_class.C: New.
* g++.dg/ext/has_trivial_constructor.C: New.
* g++.dg/ext/is_union.C: New.
* g++.dg/ext/has_trivial_destructor.C: New.
* g++.dg/tree-ssa/pr22444.C: Adjust, avoid __is_pod.
* g++.dg/template/crash43.C: Likewise.
libstdc++-v3/
2007-03-30 Paolo Carlini <pcarlini@suse.de>
PR c++/26099
* include/bits/cpp_type_traits.h (struct __is_pod, struct __is_empty):
Remove.
* include/bits/valarray_array.h: Adjust.
* include/bits/allocator.h: Likewise.
* include/bits/stl_tree.h: Likewise.
From-SVN: r123366
2007-03-30 21:45:57 +02:00
|
|
|
bool _Is_pod_comparator = __is_pod(_Key_compare)>
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
struct _Rb_tree_impl : public _Node_allocator
|
|
|
|
{
|
|
|
|
_Key_compare _M_key_compare;
|
|
|
|
_Rb_tree_node_base _M_header;
|
|
|
|
size_type _M_node_count; // Keeps track of size of tree.
|
|
|
|
|
[multiple changes]
2007-10-04 Paolo Carlini <pcarlini@suse.de>
* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_2_neg.cc: Likewise.
2007-10-04 Chris Jefferson <chris@bubblescope.net>
Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_list.h (list<>::list(list&&),
list<>::operator=(list&&)): Add.
(list<>::swap): Adjust.
(swap(list&&, list& __y), swap(list&, list&& __y)): Add.
* include/bits/stl_vector.h (vector<>::vector(vector&&),
vector<>::operator=(vector&&)): Add.
(vector<>::swap): Adjust.
(swap(vector&&, vector& __y), swap(vector&, vector&& __y)): Add.
* include/bits/stl_bvector.h (vector<>::vector(vector&&),
vector<>::operator=(vector&&)): Add.
(vector<>::swap): Adjust.
* include/bits/stl_deque.h (deque<>::deque(deque&&),
deque<>::operator=(deque&&)): Add.
(deque<>::swap): Adjust.
(swap(deque&&, deque& __y), swap(deque&, deque&& __y)): Add.
* include/bits/stl_set.h (set<>::set(set&&),
set<>::operator=(set&&)): Add.
(set<>::swap): Adjust.
(swap(set&&, set& __y), swap(set&, set&& __y)): Add.
* include/bits/stl_map.h (map<>::map(map&&),
map<>::operator=(map&&)): Add.
(map<>::swap): Adjust.
(swap(map&&, map& __y), swap(map&, map&& __y)): Add.
* include/bits/stl_multiset.h (multiset<>::multiset(multiset&&),
multiset<>::operator=(multiset&&)): Add.
(smultiet<>::swap): Adjust.
(swap(multiset&&, multiset& __y),
swap(multiset&, multiset&& __y)): Add.
* include/bits/stl_multimap.h (multimap<>::multimap(multimap&&),
multimap<>::operator=(multimap&&)): Add.
(multimap<>::swap): Adjust.
(swap(multimap&&, multimap& __y),
swap(multimap&, multimap&& __y)): Add.
2007-10-04 Paolo Carlini <pcarlini@suse.de>
Avoid copying some allocator objects.
* include/bits/stl_list.h (_List_impl::_List_impl(),
_List_base::_List_base(), list<>::list()): Add.
* include/bits/stl_vector.h (_Vector_impl::_Vector_impl(),
_Vector_base::_Vector_base(), vector<>::vector()): Add.
* include/bits/stl_bvector.h (_Bvector_impl::_Bvector_impl(),
_Bvector_base::_Bvector_base(), vector<>::vector()): Add.
* include/bits/stl_deque.h (_Deque_impl::_Deque_impl(),
_Deque_base::_Deque_base(), deque<>::deque()): Add.
* include/bits/stl_tree.h (_Rb_tree_impl<>::_Rb_tree_impl(),
_Rb_tree_impl<>::_M_initialize): Add.
(_Rb_tree<>::_Rb_tree(const _Compare&, const allocator_type&),
_Rb_tree(const _Rb_tree&)): Adjust.
* include/bits/stl_set.h (set<>::set(),
set(_InputIterator, _InputIterator)): Use _M_t default constructor.
* include/bits/stl_map.h (map<>::map(), set(_InputIterator,
_InputIterator)): Use _M_t default constructor.
* include/bits/stl_multiset.h (multiset<>::multiset(),
multiset(_InputIterator, _InputIterator)): Use _M_t default
constructor.
* include/bits/stl_multimap.h (multimap<>::multimap(),
multimap(_InputIterator, _InputIterator)): Use _M_t default
constructor.
From-SVN: r129013
2007-10-04 17:12:34 +02:00
|
|
|
_Rb_tree_impl()
|
|
|
|
: _Node_allocator(), _M_key_compare(), _M_header(),
|
2005-09-12 22:32:54 +02:00
|
|
|
_M_node_count(0)
|
[multiple changes]
2007-10-04 Paolo Carlini <pcarlini@suse.de>
* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_2_neg.cc: Likewise.
2007-10-04 Chris Jefferson <chris@bubblescope.net>
Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_list.h (list<>::list(list&&),
list<>::operator=(list&&)): Add.
(list<>::swap): Adjust.
(swap(list&&, list& __y), swap(list&, list&& __y)): Add.
* include/bits/stl_vector.h (vector<>::vector(vector&&),
vector<>::operator=(vector&&)): Add.
(vector<>::swap): Adjust.
(swap(vector&&, vector& __y), swap(vector&, vector&& __y)): Add.
* include/bits/stl_bvector.h (vector<>::vector(vector&&),
vector<>::operator=(vector&&)): Add.
(vector<>::swap): Adjust.
* include/bits/stl_deque.h (deque<>::deque(deque&&),
deque<>::operator=(deque&&)): Add.
(deque<>::swap): Adjust.
(swap(deque&&, deque& __y), swap(deque&, deque&& __y)): Add.
* include/bits/stl_set.h (set<>::set(set&&),
set<>::operator=(set&&)): Add.
(set<>::swap): Adjust.
(swap(set&&, set& __y), swap(set&, set&& __y)): Add.
* include/bits/stl_map.h (map<>::map(map&&),
map<>::operator=(map&&)): Add.
(map<>::swap): Adjust.
(swap(map&&, map& __y), swap(map&, map&& __y)): Add.
* include/bits/stl_multiset.h (multiset<>::multiset(multiset&&),
multiset<>::operator=(multiset&&)): Add.
(smultiet<>::swap): Adjust.
(swap(multiset&&, multiset& __y),
swap(multiset&, multiset&& __y)): Add.
* include/bits/stl_multimap.h (multimap<>::multimap(multimap&&),
multimap<>::operator=(multimap&&)): Add.
(multimap<>::swap): Adjust.
(swap(multimap&&, multimap& __y),
swap(multimap&, multimap&& __y)): Add.
2007-10-04 Paolo Carlini <pcarlini@suse.de>
Avoid copying some allocator objects.
* include/bits/stl_list.h (_List_impl::_List_impl(),
_List_base::_List_base(), list<>::list()): Add.
* include/bits/stl_vector.h (_Vector_impl::_Vector_impl(),
_Vector_base::_Vector_base(), vector<>::vector()): Add.
* include/bits/stl_bvector.h (_Bvector_impl::_Bvector_impl(),
_Bvector_base::_Bvector_base(), vector<>::vector()): Add.
* include/bits/stl_deque.h (_Deque_impl::_Deque_impl(),
_Deque_base::_Deque_base(), deque<>::deque()): Add.
* include/bits/stl_tree.h (_Rb_tree_impl<>::_Rb_tree_impl(),
_Rb_tree_impl<>::_M_initialize): Add.
(_Rb_tree<>::_Rb_tree(const _Compare&, const allocator_type&),
_Rb_tree(const _Rb_tree&)): Adjust.
* include/bits/stl_set.h (set<>::set(),
set(_InputIterator, _InputIterator)): Use _M_t default constructor.
* include/bits/stl_map.h (map<>::map(), set(_InputIterator,
_InputIterator)): Use _M_t default constructor.
* include/bits/stl_multiset.h (multiset<>::multiset(),
multiset(_InputIterator, _InputIterator)): Use _M_t default
constructor.
* include/bits/stl_multimap.h (multimap<>::multimap(),
multimap(_InputIterator, _InputIterator)): Use _M_t default
constructor.
From-SVN: r129013
2007-10-04 17:12:34 +02:00
|
|
|
{ _M_initialize(); }
|
|
|
|
|
|
|
|
_Rb_tree_impl(const _Key_compare& __comp, const _Node_allocator& __a)
|
|
|
|
: _Node_allocator(__a), _M_key_compare(__comp), _M_header(),
|
|
|
|
_M_node_count(0)
|
|
|
|
{ _M_initialize(); }
|
|
|
|
|
|
|
|
private:
|
|
|
|
void
|
|
|
|
_M_initialize()
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
{
|
|
|
|
this->_M_header._M_color = _S_red;
|
|
|
|
this->_M_header._M_parent = 0;
|
|
|
|
this->_M_header._M_left = &this->_M_header;
|
|
|
|
this->_M_header._M_right = &this->_M_header;
|
[multiple changes]
2007-10-04 Paolo Carlini <pcarlini@suse.de>
* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_2_neg.cc: Likewise.
2007-10-04 Chris Jefferson <chris@bubblescope.net>
Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_list.h (list<>::list(list&&),
list<>::operator=(list&&)): Add.
(list<>::swap): Adjust.
(swap(list&&, list& __y), swap(list&, list&& __y)): Add.
* include/bits/stl_vector.h (vector<>::vector(vector&&),
vector<>::operator=(vector&&)): Add.
(vector<>::swap): Adjust.
(swap(vector&&, vector& __y), swap(vector&, vector&& __y)): Add.
* include/bits/stl_bvector.h (vector<>::vector(vector&&),
vector<>::operator=(vector&&)): Add.
(vector<>::swap): Adjust.
* include/bits/stl_deque.h (deque<>::deque(deque&&),
deque<>::operator=(deque&&)): Add.
(deque<>::swap): Adjust.
(swap(deque&&, deque& __y), swap(deque&, deque&& __y)): Add.
* include/bits/stl_set.h (set<>::set(set&&),
set<>::operator=(set&&)): Add.
(set<>::swap): Adjust.
(swap(set&&, set& __y), swap(set&, set&& __y)): Add.
* include/bits/stl_map.h (map<>::map(map&&),
map<>::operator=(map&&)): Add.
(map<>::swap): Adjust.
(swap(map&&, map& __y), swap(map&, map&& __y)): Add.
* include/bits/stl_multiset.h (multiset<>::multiset(multiset&&),
multiset<>::operator=(multiset&&)): Add.
(smultiet<>::swap): Adjust.
(swap(multiset&&, multiset& __y),
swap(multiset&, multiset&& __y)): Add.
* include/bits/stl_multimap.h (multimap<>::multimap(multimap&&),
multimap<>::operator=(multimap&&)): Add.
(multimap<>::swap): Adjust.
(swap(multimap&&, multimap& __y),
swap(multimap&, multimap&& __y)): Add.
2007-10-04 Paolo Carlini <pcarlini@suse.de>
Avoid copying some allocator objects.
* include/bits/stl_list.h (_List_impl::_List_impl(),
_List_base::_List_base(), list<>::list()): Add.
* include/bits/stl_vector.h (_Vector_impl::_Vector_impl(),
_Vector_base::_Vector_base(), vector<>::vector()): Add.
* include/bits/stl_bvector.h (_Bvector_impl::_Bvector_impl(),
_Bvector_base::_Bvector_base(), vector<>::vector()): Add.
* include/bits/stl_deque.h (_Deque_impl::_Deque_impl(),
_Deque_base::_Deque_base(), deque<>::deque()): Add.
* include/bits/stl_tree.h (_Rb_tree_impl<>::_Rb_tree_impl(),
_Rb_tree_impl<>::_M_initialize): Add.
(_Rb_tree<>::_Rb_tree(const _Compare&, const allocator_type&),
_Rb_tree(const _Rb_tree&)): Adjust.
* include/bits/stl_set.h (set<>::set(),
set(_InputIterator, _InputIterator)): Use _M_t default constructor.
* include/bits/stl_map.h (map<>::map(), set(_InputIterator,
_InputIterator)): Use _M_t default constructor.
* include/bits/stl_multiset.h (multiset<>::multiset(),
multiset(_InputIterator, _InputIterator)): Use _M_t default
constructor.
* include/bits/stl_multimap.h (multimap<>::multimap(),
multimap(_InputIterator, _InputIterator)): Use _M_t default
constructor.
From-SVN: r129013
2007-10-04 17:12:34 +02:00
|
|
|
}
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
// Specialization for _Comparison types that are not capable of
|
|
|
|
// being base classes / super classes.
|
|
|
|
template<typename _Key_compare>
|
|
|
|
struct _Rb_tree_impl<_Key_compare, true> : public _Node_allocator
|
|
|
|
{
|
|
|
|
_Key_compare _M_key_compare;
|
|
|
|
_Rb_tree_node_base _M_header;
|
|
|
|
size_type _M_node_count; // Keeps track of size of tree.
|
|
|
|
|
[multiple changes]
2007-10-04 Paolo Carlini <pcarlini@suse.de>
* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_2_neg.cc: Likewise.
2007-10-04 Chris Jefferson <chris@bubblescope.net>
Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_list.h (list<>::list(list&&),
list<>::operator=(list&&)): Add.
(list<>::swap): Adjust.
(swap(list&&, list& __y), swap(list&, list&& __y)): Add.
* include/bits/stl_vector.h (vector<>::vector(vector&&),
vector<>::operator=(vector&&)): Add.
(vector<>::swap): Adjust.
(swap(vector&&, vector& __y), swap(vector&, vector&& __y)): Add.
* include/bits/stl_bvector.h (vector<>::vector(vector&&),
vector<>::operator=(vector&&)): Add.
(vector<>::swap): Adjust.
* include/bits/stl_deque.h (deque<>::deque(deque&&),
deque<>::operator=(deque&&)): Add.
(deque<>::swap): Adjust.
(swap(deque&&, deque& __y), swap(deque&, deque&& __y)): Add.
* include/bits/stl_set.h (set<>::set(set&&),
set<>::operator=(set&&)): Add.
(set<>::swap): Adjust.
(swap(set&&, set& __y), swap(set&, set&& __y)): Add.
* include/bits/stl_map.h (map<>::map(map&&),
map<>::operator=(map&&)): Add.
(map<>::swap): Adjust.
(swap(map&&, map& __y), swap(map&, map&& __y)): Add.
* include/bits/stl_multiset.h (multiset<>::multiset(multiset&&),
multiset<>::operator=(multiset&&)): Add.
(smultiet<>::swap): Adjust.
(swap(multiset&&, multiset& __y),
swap(multiset&, multiset&& __y)): Add.
* include/bits/stl_multimap.h (multimap<>::multimap(multimap&&),
multimap<>::operator=(multimap&&)): Add.
(multimap<>::swap): Adjust.
(swap(multimap&&, multimap& __y),
swap(multimap&, multimap&& __y)): Add.
2007-10-04 Paolo Carlini <pcarlini@suse.de>
Avoid copying some allocator objects.
* include/bits/stl_list.h (_List_impl::_List_impl(),
_List_base::_List_base(), list<>::list()): Add.
* include/bits/stl_vector.h (_Vector_impl::_Vector_impl(),
_Vector_base::_Vector_base(), vector<>::vector()): Add.
* include/bits/stl_bvector.h (_Bvector_impl::_Bvector_impl(),
_Bvector_base::_Bvector_base(), vector<>::vector()): Add.
* include/bits/stl_deque.h (_Deque_impl::_Deque_impl(),
_Deque_base::_Deque_base(), deque<>::deque()): Add.
* include/bits/stl_tree.h (_Rb_tree_impl<>::_Rb_tree_impl(),
_Rb_tree_impl<>::_M_initialize): Add.
(_Rb_tree<>::_Rb_tree(const _Compare&, const allocator_type&),
_Rb_tree(const _Rb_tree&)): Adjust.
* include/bits/stl_set.h (set<>::set(),
set(_InputIterator, _InputIterator)): Use _M_t default constructor.
* include/bits/stl_map.h (map<>::map(), set(_InputIterator,
_InputIterator)): Use _M_t default constructor.
* include/bits/stl_multiset.h (multiset<>::multiset(),
multiset(_InputIterator, _InputIterator)): Use _M_t default
constructor.
* include/bits/stl_multimap.h (multimap<>::multimap(),
multimap(_InputIterator, _InputIterator)): Use _M_t default
constructor.
From-SVN: r129013
2007-10-04 17:12:34 +02:00
|
|
|
_Rb_tree_impl()
|
|
|
|
: _Node_allocator(), _M_key_compare(), _M_header(),
|
|
|
|
_M_node_count(0)
|
|
|
|
{ _M_initialize(); }
|
|
|
|
|
|
|
|
_Rb_tree_impl(const _Key_compare& __comp, const _Node_allocator& __a)
|
2005-09-18 15:39:25 +02:00
|
|
|
: _Node_allocator(__a), _M_key_compare(__comp), _M_header(),
|
|
|
|
_M_node_count(0)
|
[multiple changes]
2007-10-04 Paolo Carlini <pcarlini@suse.de>
* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_2_neg.cc: Likewise.
2007-10-04 Chris Jefferson <chris@bubblescope.net>
Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_list.h (list<>::list(list&&),
list<>::operator=(list&&)): Add.
(list<>::swap): Adjust.
(swap(list&&, list& __y), swap(list&, list&& __y)): Add.
* include/bits/stl_vector.h (vector<>::vector(vector&&),
vector<>::operator=(vector&&)): Add.
(vector<>::swap): Adjust.
(swap(vector&&, vector& __y), swap(vector&, vector&& __y)): Add.
* include/bits/stl_bvector.h (vector<>::vector(vector&&),
vector<>::operator=(vector&&)): Add.
(vector<>::swap): Adjust.
* include/bits/stl_deque.h (deque<>::deque(deque&&),
deque<>::operator=(deque&&)): Add.
(deque<>::swap): Adjust.
(swap(deque&&, deque& __y), swap(deque&, deque&& __y)): Add.
* include/bits/stl_set.h (set<>::set(set&&),
set<>::operator=(set&&)): Add.
(set<>::swap): Adjust.
(swap(set&&, set& __y), swap(set&, set&& __y)): Add.
* include/bits/stl_map.h (map<>::map(map&&),
map<>::operator=(map&&)): Add.
(map<>::swap): Adjust.
(swap(map&&, map& __y), swap(map&, map&& __y)): Add.
* include/bits/stl_multiset.h (multiset<>::multiset(multiset&&),
multiset<>::operator=(multiset&&)): Add.
(smultiet<>::swap): Adjust.
(swap(multiset&&, multiset& __y),
swap(multiset&, multiset&& __y)): Add.
* include/bits/stl_multimap.h (multimap<>::multimap(multimap&&),
multimap<>::operator=(multimap&&)): Add.
(multimap<>::swap): Adjust.
(swap(multimap&&, multimap& __y),
swap(multimap&, multimap&& __y)): Add.
2007-10-04 Paolo Carlini <pcarlini@suse.de>
Avoid copying some allocator objects.
* include/bits/stl_list.h (_List_impl::_List_impl(),
_List_base::_List_base(), list<>::list()): Add.
* include/bits/stl_vector.h (_Vector_impl::_Vector_impl(),
_Vector_base::_Vector_base(), vector<>::vector()): Add.
* include/bits/stl_bvector.h (_Bvector_impl::_Bvector_impl(),
_Bvector_base::_Bvector_base(), vector<>::vector()): Add.
* include/bits/stl_deque.h (_Deque_impl::_Deque_impl(),
_Deque_base::_Deque_base(), deque<>::deque()): Add.
* include/bits/stl_tree.h (_Rb_tree_impl<>::_Rb_tree_impl(),
_Rb_tree_impl<>::_M_initialize): Add.
(_Rb_tree<>::_Rb_tree(const _Compare&, const allocator_type&),
_Rb_tree(const _Rb_tree&)): Adjust.
* include/bits/stl_set.h (set<>::set(),
set(_InputIterator, _InputIterator)): Use _M_t default constructor.
* include/bits/stl_map.h (map<>::map(), set(_InputIterator,
_InputIterator)): Use _M_t default constructor.
* include/bits/stl_multiset.h (multiset<>::multiset(),
multiset(_InputIterator, _InputIterator)): Use _M_t default
constructor.
* include/bits/stl_multimap.h (multimap<>::multimap(),
multimap(_InputIterator, _InputIterator)): Use _M_t default
constructor.
From-SVN: r129013
2007-10-04 17:12:34 +02:00
|
|
|
{ _M_initialize(); }
|
|
|
|
|
|
|
|
private:
|
|
|
|
void
|
|
|
|
_M_initialize()
|
|
|
|
{
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
this->_M_header._M_color = _S_red;
|
|
|
|
this->_M_header._M_parent = 0;
|
|
|
|
this->_M_header._M_left = &this->_M_header;
|
|
|
|
this->_M_header._M_right = &this->_M_header;
|
[multiple changes]
2007-10-04 Paolo Carlini <pcarlini@suse.de>
* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_2_neg.cc: Likewise.
2007-10-04 Chris Jefferson <chris@bubblescope.net>
Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_list.h (list<>::list(list&&),
list<>::operator=(list&&)): Add.
(list<>::swap): Adjust.
(swap(list&&, list& __y), swap(list&, list&& __y)): Add.
* include/bits/stl_vector.h (vector<>::vector(vector&&),
vector<>::operator=(vector&&)): Add.
(vector<>::swap): Adjust.
(swap(vector&&, vector& __y), swap(vector&, vector&& __y)): Add.
* include/bits/stl_bvector.h (vector<>::vector(vector&&),
vector<>::operator=(vector&&)): Add.
(vector<>::swap): Adjust.
* include/bits/stl_deque.h (deque<>::deque(deque&&),
deque<>::operator=(deque&&)): Add.
(deque<>::swap): Adjust.
(swap(deque&&, deque& __y), swap(deque&, deque&& __y)): Add.
* include/bits/stl_set.h (set<>::set(set&&),
set<>::operator=(set&&)): Add.
(set<>::swap): Adjust.
(swap(set&&, set& __y), swap(set&, set&& __y)): Add.
* include/bits/stl_map.h (map<>::map(map&&),
map<>::operator=(map&&)): Add.
(map<>::swap): Adjust.
(swap(map&&, map& __y), swap(map&, map&& __y)): Add.
* include/bits/stl_multiset.h (multiset<>::multiset(multiset&&),
multiset<>::operator=(multiset&&)): Add.
(smultiet<>::swap): Adjust.
(swap(multiset&&, multiset& __y),
swap(multiset&, multiset&& __y)): Add.
* include/bits/stl_multimap.h (multimap<>::multimap(multimap&&),
multimap<>::operator=(multimap&&)): Add.
(multimap<>::swap): Adjust.
(swap(multimap&&, multimap& __y),
swap(multimap&, multimap&& __y)): Add.
2007-10-04 Paolo Carlini <pcarlini@suse.de>
Avoid copying some allocator objects.
* include/bits/stl_list.h (_List_impl::_List_impl(),
_List_base::_List_base(), list<>::list()): Add.
* include/bits/stl_vector.h (_Vector_impl::_Vector_impl(),
_Vector_base::_Vector_base(), vector<>::vector()): Add.
* include/bits/stl_bvector.h (_Bvector_impl::_Bvector_impl(),
_Bvector_base::_Bvector_base(), vector<>::vector()): Add.
* include/bits/stl_deque.h (_Deque_impl::_Deque_impl(),
_Deque_base::_Deque_base(), deque<>::deque()): Add.
* include/bits/stl_tree.h (_Rb_tree_impl<>::_Rb_tree_impl(),
_Rb_tree_impl<>::_M_initialize): Add.
(_Rb_tree<>::_Rb_tree(const _Compare&, const allocator_type&),
_Rb_tree(const _Rb_tree&)): Adjust.
* include/bits/stl_set.h (set<>::set(),
set(_InputIterator, _InputIterator)): Use _M_t default constructor.
* include/bits/stl_map.h (map<>::map(), set(_InputIterator,
_InputIterator)): Use _M_t default constructor.
* include/bits/stl_multiset.h (multiset<>::multiset(),
multiset(_InputIterator, _InputIterator)): Use _M_t default
constructor.
* include/bits/stl_multimap.h (multimap<>::multimap(),
multimap(_InputIterator, _InputIterator)): Use _M_t default
constructor.
From-SVN: r129013
2007-10-04 17:12:34 +02:00
|
|
|
}
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
_Rb_tree_impl<_Compare> _M_impl;
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2003-12-23 01:09:26 +01:00
|
|
|
protected:
|
2003-07-30 17:01:58 +02:00
|
|
|
_Base_ptr&
|
2004-02-01 12:25:21 +01:00
|
|
|
_M_root()
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
{ return this->_M_impl._M_header._M_parent; }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2003-07-30 17:01:58 +02:00
|
|
|
_Const_Base_ptr
|
2004-02-01 12:25:21 +01:00
|
|
|
_M_root() const
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
{ return this->_M_impl._M_header._M_parent; }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2003-07-30 17:01:58 +02:00
|
|
|
_Base_ptr&
|
2004-02-01 12:25:21 +01:00
|
|
|
_M_leftmost()
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
{ return this->_M_impl._M_header._M_left; }
|
2003-07-30 17:01:58 +02:00
|
|
|
|
|
|
|
_Const_Base_ptr
|
2004-02-01 12:25:21 +01:00
|
|
|
_M_leftmost() const
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
{ return this->_M_impl._M_header._M_left; }
|
2003-07-30 17:01:58 +02:00
|
|
|
|
|
|
|
_Base_ptr&
|
2004-02-01 12:25:21 +01:00
|
|
|
_M_rightmost()
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
{ return this->_M_impl._M_header._M_right; }
|
2003-07-30 17:01:58 +02:00
|
|
|
|
|
|
|
_Const_Base_ptr
|
2004-02-01 12:25:21 +01:00
|
|
|
_M_rightmost() const
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
{ return this->_M_impl._M_header._M_right; }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2003-07-04 22:37:01 +02:00
|
|
|
_Link_type
|
2004-02-01 12:25:21 +01:00
|
|
|
_M_begin()
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
{ return static_cast<_Link_type>(this->_M_impl._M_header._M_parent); }
|
2003-07-30 17:01:58 +02:00
|
|
|
|
|
|
|
_Const_Link_type
|
2004-02-01 12:25:21 +01:00
|
|
|
_M_begin() const
|
2004-10-03 17:50:32 +02:00
|
|
|
{
|
|
|
|
return static_cast<_Const_Link_type>
|
|
|
|
(this->_M_impl._M_header._M_parent);
|
|
|
|
}
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2003-07-30 17:01:58 +02:00
|
|
|
_Link_type
|
2004-02-01 12:25:21 +01:00
|
|
|
_M_end()
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
{ return static_cast<_Link_type>(&this->_M_impl._M_header); }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2003-07-30 17:01:58 +02:00
|
|
|
_Const_Link_type
|
2004-02-01 12:25:21 +01:00
|
|
|
_M_end() const
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
{ return static_cast<_Const_Link_type>(&this->_M_impl._M_header); }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
static const_reference
|
2004-02-01 12:25:21 +01:00
|
|
|
_S_value(_Const_Link_type __x)
|
|
|
|
{ return __x->_M_value_field; }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
static const _Key&
|
2004-02-01 12:25:21 +01:00
|
|
|
_S_key(_Const_Link_type __x)
|
|
|
|
{ return _KeyOfValue()(_S_value(__x)); }
|
2003-07-30 17:01:58 +02:00
|
|
|
|
|
|
|
static _Link_type
|
2004-02-01 12:25:21 +01:00
|
|
|
_S_left(_Base_ptr __x)
|
|
|
|
{ return static_cast<_Link_type>(__x->_M_left); }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2003-07-30 17:01:58 +02:00
|
|
|
static _Const_Link_type
|
2004-02-01 12:25:21 +01:00
|
|
|
_S_left(_Const_Base_ptr __x)
|
|
|
|
{ return static_cast<_Const_Link_type>(__x->_M_left); }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2003-07-30 17:01:58 +02:00
|
|
|
static _Link_type
|
2004-02-01 12:25:21 +01:00
|
|
|
_S_right(_Base_ptr __x)
|
|
|
|
{ return static_cast<_Link_type>(__x->_M_right); }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2003-07-30 17:01:58 +02:00
|
|
|
static _Const_Link_type
|
2004-02-01 12:25:21 +01:00
|
|
|
_S_right(_Const_Base_ptr __x)
|
|
|
|
{ return static_cast<_Const_Link_type>(__x->_M_right); }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2003-07-30 17:01:58 +02:00
|
|
|
static const_reference
|
2004-02-01 12:25:21 +01:00
|
|
|
_S_value(_Const_Base_ptr __x)
|
|
|
|
{ return static_cast<_Const_Link_type>(__x)->_M_value_field; }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
static const _Key&
|
2004-02-01 12:25:21 +01:00
|
|
|
_S_key(_Const_Base_ptr __x)
|
|
|
|
{ return _KeyOfValue()(_S_value(__x)); }
|
2003-07-30 17:01:58 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
static _Base_ptr
|
|
|
|
_S_minimum(_Base_ptr __x)
|
2003-07-30 17:01:58 +02:00
|
|
|
{ return _Rb_tree_node_base::_S_minimum(__x); }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2003-07-30 17:01:58 +02:00
|
|
|
static _Const_Base_ptr
|
|
|
|
_S_minimum(_Const_Base_ptr __x)
|
|
|
|
{ return _Rb_tree_node_base::_S_minimum(__x); }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2003-07-30 17:01:58 +02:00
|
|
|
static _Base_ptr
|
|
|
|
_S_maximum(_Base_ptr __x)
|
|
|
|
{ return _Rb_tree_node_base::_S_maximum(__x); }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2003-07-30 17:01:58 +02:00
|
|
|
static _Const_Base_ptr
|
|
|
|
_S_maximum(_Const_Base_ptr __x)
|
|
|
|
{ return _Rb_tree_node_base::_S_maximum(__x); }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
|
|
|
public:
|
2004-01-07 21:55:06 +01:00
|
|
|
typedef _Rb_tree_iterator<value_type> iterator;
|
|
|
|
typedef _Rb_tree_const_iterator<value_type> const_iterator;
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-01-07 21:55:06 +01:00
|
|
|
typedef std::reverse_iterator<iterator> reverse_iterator;
|
2002-09-11 01:19:10 +02:00
|
|
|
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
2002-03-07 07:53:23 +01:00
|
|
|
|
|
|
|
private:
|
2004-02-08 05:46:42 +01:00
|
|
|
iterator
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
_M_insert_(_Const_Base_ptr __x, _Const_Base_ptr __y,
|
|
|
|
const value_type& __v);
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2006-01-08 18:34:32 +01:00
|
|
|
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
|
|
|
// 233. Insertion hints in associative containers.
|
|
|
|
iterator
|
|
|
|
_M_insert_lower(_Base_ptr __x, _Base_ptr __y, const value_type& __v);
|
|
|
|
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
iterator
|
|
|
|
_M_insert_equal_lower(const value_type& __x);
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
_Link_type
|
2003-07-30 17:01:58 +02:00
|
|
|
_M_copy(_Const_Link_type __x, _Link_type __p);
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
void
|
2002-03-07 07:53:23 +01:00
|
|
|
_M_erase(_Link_type __x);
|
|
|
|
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
iterator
|
re PR libstdc++/31440 (libstdc++-g++-v3 discarded qualifiers)
2007-04-03 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/31440
* include/bits/stl_tree.h (_M_lower_bound(_Link_type, _Link_type,
const _Key&), _M_upper_bound(_Link_type, _Link_type, const _Key&)):
Add.
(_M_equal_range(const _Key&) const): Remove.
(lower_bound(const key_type&), lower_bound(const key_type&) const,
upper_bound(const key_type&), upper_bound(const key_type&) const,
equal_range(const key_type&), equal_range(const key_type&) const):
Adjust.
(find(const _Key&), find(const _Key&) const): Tweak.
* testsuite/23_containers/map/operations/31440.cc: New.
From-SVN: r123452
2007-04-03 10:32:31 +02:00
|
|
|
_M_lower_bound(_Link_type __x, _Link_type __y,
|
|
|
|
const _Key& __k);
|
|
|
|
|
|
|
|
const_iterator
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
_M_lower_bound(_Const_Link_type __x, _Const_Link_type __y,
|
|
|
|
const _Key& __k) const;
|
|
|
|
|
|
|
|
iterator
|
re PR libstdc++/31440 (libstdc++-g++-v3 discarded qualifiers)
2007-04-03 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/31440
* include/bits/stl_tree.h (_M_lower_bound(_Link_type, _Link_type,
const _Key&), _M_upper_bound(_Link_type, _Link_type, const _Key&)):
Add.
(_M_equal_range(const _Key&) const): Remove.
(lower_bound(const key_type&), lower_bound(const key_type&) const,
upper_bound(const key_type&), upper_bound(const key_type&) const,
equal_range(const key_type&), equal_range(const key_type&) const):
Adjust.
(find(const _Key&), find(const _Key&) const): Tweak.
* testsuite/23_containers/map/operations/31440.cc: New.
From-SVN: r123452
2007-04-03 10:32:31 +02:00
|
|
|
_M_upper_bound(_Link_type __x, _Link_type __y,
|
|
|
|
const _Key& __k);
|
|
|
|
|
|
|
|
const_iterator
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
_M_upper_bound(_Const_Link_type __x, _Const_Link_type __y,
|
|
|
|
const _Key& __k) const;
|
|
|
|
|
2002-03-07 07:53:23 +01:00
|
|
|
public:
|
|
|
|
// allocation/deallocation
|
[multiple changes]
2007-10-04 Paolo Carlini <pcarlini@suse.de>
* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_2_neg.cc: Likewise.
2007-10-04 Chris Jefferson <chris@bubblescope.net>
Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_list.h (list<>::list(list&&),
list<>::operator=(list&&)): Add.
(list<>::swap): Adjust.
(swap(list&&, list& __y), swap(list&, list&& __y)): Add.
* include/bits/stl_vector.h (vector<>::vector(vector&&),
vector<>::operator=(vector&&)): Add.
(vector<>::swap): Adjust.
(swap(vector&&, vector& __y), swap(vector&, vector&& __y)): Add.
* include/bits/stl_bvector.h (vector<>::vector(vector&&),
vector<>::operator=(vector&&)): Add.
(vector<>::swap): Adjust.
* include/bits/stl_deque.h (deque<>::deque(deque&&),
deque<>::operator=(deque&&)): Add.
(deque<>::swap): Adjust.
(swap(deque&&, deque& __y), swap(deque&, deque&& __y)): Add.
* include/bits/stl_set.h (set<>::set(set&&),
set<>::operator=(set&&)): Add.
(set<>::swap): Adjust.
(swap(set&&, set& __y), swap(set&, set&& __y)): Add.
* include/bits/stl_map.h (map<>::map(map&&),
map<>::operator=(map&&)): Add.
(map<>::swap): Adjust.
(swap(map&&, map& __y), swap(map&, map&& __y)): Add.
* include/bits/stl_multiset.h (multiset<>::multiset(multiset&&),
multiset<>::operator=(multiset&&)): Add.
(smultiet<>::swap): Adjust.
(swap(multiset&&, multiset& __y),
swap(multiset&, multiset&& __y)): Add.
* include/bits/stl_multimap.h (multimap<>::multimap(multimap&&),
multimap<>::operator=(multimap&&)): Add.
(multimap<>::swap): Adjust.
(swap(multimap&&, multimap& __y),
swap(multimap&, multimap&& __y)): Add.
2007-10-04 Paolo Carlini <pcarlini@suse.de>
Avoid copying some allocator objects.
* include/bits/stl_list.h (_List_impl::_List_impl(),
_List_base::_List_base(), list<>::list()): Add.
* include/bits/stl_vector.h (_Vector_impl::_Vector_impl(),
_Vector_base::_Vector_base(), vector<>::vector()): Add.
* include/bits/stl_bvector.h (_Bvector_impl::_Bvector_impl(),
_Bvector_base::_Bvector_base(), vector<>::vector()): Add.
* include/bits/stl_deque.h (_Deque_impl::_Deque_impl(),
_Deque_base::_Deque_base(), deque<>::deque()): Add.
* include/bits/stl_tree.h (_Rb_tree_impl<>::_Rb_tree_impl(),
_Rb_tree_impl<>::_M_initialize): Add.
(_Rb_tree<>::_Rb_tree(const _Compare&, const allocator_type&),
_Rb_tree(const _Rb_tree&)): Adjust.
* include/bits/stl_set.h (set<>::set(),
set(_InputIterator, _InputIterator)): Use _M_t default constructor.
* include/bits/stl_map.h (map<>::map(), set(_InputIterator,
_InputIterator)): Use _M_t default constructor.
* include/bits/stl_multiset.h (multiset<>::multiset(),
multiset(_InputIterator, _InputIterator)): Use _M_t default
constructor.
* include/bits/stl_multimap.h (multimap<>::multimap(),
multimap(_InputIterator, _InputIterator)): Use _M_t default
constructor.
From-SVN: r129013
2007-10-04 17:12:34 +02:00
|
|
|
_Rb_tree() { }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
[multiple changes]
2007-10-04 Paolo Carlini <pcarlini@suse.de>
* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_2_neg.cc: Likewise.
2007-10-04 Chris Jefferson <chris@bubblescope.net>
Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_list.h (list<>::list(list&&),
list<>::operator=(list&&)): Add.
(list<>::swap): Adjust.
(swap(list&&, list& __y), swap(list&, list&& __y)): Add.
* include/bits/stl_vector.h (vector<>::vector(vector&&),
vector<>::operator=(vector&&)): Add.
(vector<>::swap): Adjust.
(swap(vector&&, vector& __y), swap(vector&, vector&& __y)): Add.
* include/bits/stl_bvector.h (vector<>::vector(vector&&),
vector<>::operator=(vector&&)): Add.
(vector<>::swap): Adjust.
* include/bits/stl_deque.h (deque<>::deque(deque&&),
deque<>::operator=(deque&&)): Add.
(deque<>::swap): Adjust.
(swap(deque&&, deque& __y), swap(deque&, deque&& __y)): Add.
* include/bits/stl_set.h (set<>::set(set&&),
set<>::operator=(set&&)): Add.
(set<>::swap): Adjust.
(swap(set&&, set& __y), swap(set&, set&& __y)): Add.
* include/bits/stl_map.h (map<>::map(map&&),
map<>::operator=(map&&)): Add.
(map<>::swap): Adjust.
(swap(map&&, map& __y), swap(map&, map&& __y)): Add.
* include/bits/stl_multiset.h (multiset<>::multiset(multiset&&),
multiset<>::operator=(multiset&&)): Add.
(smultiet<>::swap): Adjust.
(swap(multiset&&, multiset& __y),
swap(multiset&, multiset&& __y)): Add.
* include/bits/stl_multimap.h (multimap<>::multimap(multimap&&),
multimap<>::operator=(multimap&&)): Add.
(multimap<>::swap): Adjust.
(swap(multimap&&, multimap& __y),
swap(multimap&, multimap&& __y)): Add.
2007-10-04 Paolo Carlini <pcarlini@suse.de>
Avoid copying some allocator objects.
* include/bits/stl_list.h (_List_impl::_List_impl(),
_List_base::_List_base(), list<>::list()): Add.
* include/bits/stl_vector.h (_Vector_impl::_Vector_impl(),
_Vector_base::_Vector_base(), vector<>::vector()): Add.
* include/bits/stl_bvector.h (_Bvector_impl::_Bvector_impl(),
_Bvector_base::_Bvector_base(), vector<>::vector()): Add.
* include/bits/stl_deque.h (_Deque_impl::_Deque_impl(),
_Deque_base::_Deque_base(), deque<>::deque()): Add.
* include/bits/stl_tree.h (_Rb_tree_impl<>::_Rb_tree_impl(),
_Rb_tree_impl<>::_M_initialize): Add.
(_Rb_tree<>::_Rb_tree(const _Compare&, const allocator_type&),
_Rb_tree(const _Rb_tree&)): Adjust.
* include/bits/stl_set.h (set<>::set(),
set(_InputIterator, _InputIterator)): Use _M_t default constructor.
* include/bits/stl_map.h (map<>::map(), set(_InputIterator,
_InputIterator)): Use _M_t default constructor.
* include/bits/stl_multiset.h (multiset<>::multiset(),
multiset(_InputIterator, _InputIterator)): Use _M_t default
constructor.
* include/bits/stl_multimap.h (multimap<>::multimap(),
multimap(_InputIterator, _InputIterator)): Use _M_t default
constructor.
From-SVN: r129013
2007-10-04 17:12:34 +02:00
|
|
|
_Rb_tree(const _Compare& __comp,
|
|
|
|
const allocator_type& __a = allocator_type())
|
|
|
|
: _M_impl(__comp, __a) { }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
[multiple changes]
2007-10-04 Paolo Carlini <pcarlini@suse.de>
* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_2_neg.cc: Likewise.
2007-10-04 Chris Jefferson <chris@bubblescope.net>
Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_list.h (list<>::list(list&&),
list<>::operator=(list&&)): Add.
(list<>::swap): Adjust.
(swap(list&&, list& __y), swap(list&, list&& __y)): Add.
* include/bits/stl_vector.h (vector<>::vector(vector&&),
vector<>::operator=(vector&&)): Add.
(vector<>::swap): Adjust.
(swap(vector&&, vector& __y), swap(vector&, vector&& __y)): Add.
* include/bits/stl_bvector.h (vector<>::vector(vector&&),
vector<>::operator=(vector&&)): Add.
(vector<>::swap): Adjust.
* include/bits/stl_deque.h (deque<>::deque(deque&&),
deque<>::operator=(deque&&)): Add.
(deque<>::swap): Adjust.
(swap(deque&&, deque& __y), swap(deque&, deque&& __y)): Add.
* include/bits/stl_set.h (set<>::set(set&&),
set<>::operator=(set&&)): Add.
(set<>::swap): Adjust.
(swap(set&&, set& __y), swap(set&, set&& __y)): Add.
* include/bits/stl_map.h (map<>::map(map&&),
map<>::operator=(map&&)): Add.
(map<>::swap): Adjust.
(swap(map&&, map& __y), swap(map&, map&& __y)): Add.
* include/bits/stl_multiset.h (multiset<>::multiset(multiset&&),
multiset<>::operator=(multiset&&)): Add.
(smultiet<>::swap): Adjust.
(swap(multiset&&, multiset& __y),
swap(multiset&, multiset&& __y)): Add.
* include/bits/stl_multimap.h (multimap<>::multimap(multimap&&),
multimap<>::operator=(multimap&&)): Add.
(multimap<>::swap): Adjust.
(swap(multimap&&, multimap& __y),
swap(multimap&, multimap&& __y)): Add.
2007-10-04 Paolo Carlini <pcarlini@suse.de>
Avoid copying some allocator objects.
* include/bits/stl_list.h (_List_impl::_List_impl(),
_List_base::_List_base(), list<>::list()): Add.
* include/bits/stl_vector.h (_Vector_impl::_Vector_impl(),
_Vector_base::_Vector_base(), vector<>::vector()): Add.
* include/bits/stl_bvector.h (_Bvector_impl::_Bvector_impl(),
_Bvector_base::_Bvector_base(), vector<>::vector()): Add.
* include/bits/stl_deque.h (_Deque_impl::_Deque_impl(),
_Deque_base::_Deque_base(), deque<>::deque()): Add.
* include/bits/stl_tree.h (_Rb_tree_impl<>::_Rb_tree_impl(),
_Rb_tree_impl<>::_M_initialize): Add.
(_Rb_tree<>::_Rb_tree(const _Compare&, const allocator_type&),
_Rb_tree(const _Rb_tree&)): Adjust.
* include/bits/stl_set.h (set<>::set(),
set(_InputIterator, _InputIterator)): Use _M_t default constructor.
* include/bits/stl_map.h (map<>::map(), set(_InputIterator,
_InputIterator)): Use _M_t default constructor.
* include/bits/stl_multiset.h (multiset<>::multiset(),
multiset(_InputIterator, _InputIterator)): Use _M_t default
constructor.
* include/bits/stl_multimap.h (multimap<>::multimap(),
multimap(_InputIterator, _InputIterator)): Use _M_t default
constructor.
From-SVN: r129013
2007-10-04 17:12:34 +02:00
|
|
|
_Rb_tree(const _Rb_tree& __x)
|
|
|
|
: _M_impl(__x._M_impl._M_key_compare, __x._M_get_Node_allocator())
|
2004-02-08 05:46:42 +01:00
|
|
|
{
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
if (__x._M_root() != 0)
|
2002-03-07 07:53:23 +01:00
|
|
|
{
|
2003-07-30 17:01:58 +02:00
|
|
|
_M_root() = _M_copy(__x._M_begin(), _M_end());
|
2002-03-07 07:53:23 +01:00
|
|
|
_M_leftmost() = _S_minimum(_M_root());
|
|
|
|
_M_rightmost() = _S_maximum(_M_root());
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
_M_impl._M_node_count = __x._M_impl._M_node_count;
|
2002-03-07 07:53:23 +01:00
|
|
|
}
|
2000-10-05 13:27:02 +02:00
|
|
|
}
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2007-10-16 17:20:09 +02:00
|
|
|
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
|
|
|
_Rb_tree(_Rb_tree&& __x);
|
|
|
|
#endif
|
|
|
|
|
2004-02-02 00:19:55 +01:00
|
|
|
~_Rb_tree()
|
|
|
|
{ _M_erase(_M_begin()); }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
[multiple changes]
2007-10-04 Paolo Carlini <pcarlini@suse.de>
* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_2_neg.cc: Likewise.
2007-10-04 Chris Jefferson <chris@bubblescope.net>
Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_list.h (list<>::list(list&&),
list<>::operator=(list&&)): Add.
(list<>::swap): Adjust.
(swap(list&&, list& __y), swap(list&, list&& __y)): Add.
* include/bits/stl_vector.h (vector<>::vector(vector&&),
vector<>::operator=(vector&&)): Add.
(vector<>::swap): Adjust.
(swap(vector&&, vector& __y), swap(vector&, vector&& __y)): Add.
* include/bits/stl_bvector.h (vector<>::vector(vector&&),
vector<>::operator=(vector&&)): Add.
(vector<>::swap): Adjust.
* include/bits/stl_deque.h (deque<>::deque(deque&&),
deque<>::operator=(deque&&)): Add.
(deque<>::swap): Adjust.
(swap(deque&&, deque& __y), swap(deque&, deque&& __y)): Add.
* include/bits/stl_set.h (set<>::set(set&&),
set<>::operator=(set&&)): Add.
(set<>::swap): Adjust.
(swap(set&&, set& __y), swap(set&, set&& __y)): Add.
* include/bits/stl_map.h (map<>::map(map&&),
map<>::operator=(map&&)): Add.
(map<>::swap): Adjust.
(swap(map&&, map& __y), swap(map&, map&& __y)): Add.
* include/bits/stl_multiset.h (multiset<>::multiset(multiset&&),
multiset<>::operator=(multiset&&)): Add.
(smultiet<>::swap): Adjust.
(swap(multiset&&, multiset& __y),
swap(multiset&, multiset&& __y)): Add.
* include/bits/stl_multimap.h (multimap<>::multimap(multimap&&),
multimap<>::operator=(multimap&&)): Add.
(multimap<>::swap): Adjust.
(swap(multimap&&, multimap& __y),
swap(multimap&, multimap&& __y)): Add.
2007-10-04 Paolo Carlini <pcarlini@suse.de>
Avoid copying some allocator objects.
* include/bits/stl_list.h (_List_impl::_List_impl(),
_List_base::_List_base(), list<>::list()): Add.
* include/bits/stl_vector.h (_Vector_impl::_Vector_impl(),
_Vector_base::_Vector_base(), vector<>::vector()): Add.
* include/bits/stl_bvector.h (_Bvector_impl::_Bvector_impl(),
_Bvector_base::_Bvector_base(), vector<>::vector()): Add.
* include/bits/stl_deque.h (_Deque_impl::_Deque_impl(),
_Deque_base::_Deque_base(), deque<>::deque()): Add.
* include/bits/stl_tree.h (_Rb_tree_impl<>::_Rb_tree_impl(),
_Rb_tree_impl<>::_M_initialize): Add.
(_Rb_tree<>::_Rb_tree(const _Compare&, const allocator_type&),
_Rb_tree(const _Rb_tree&)): Adjust.
* include/bits/stl_set.h (set<>::set(),
set(_InputIterator, _InputIterator)): Use _M_t default constructor.
* include/bits/stl_map.h (map<>::map(), set(_InputIterator,
_InputIterator)): Use _M_t default constructor.
* include/bits/stl_multiset.h (multiset<>::multiset(),
multiset(_InputIterator, _InputIterator)): Use _M_t default
constructor.
* include/bits/stl_multimap.h (multimap<>::multimap(),
multimap(_InputIterator, _InputIterator)): Use _M_t default
constructor.
From-SVN: r129013
2007-10-04 17:12:34 +02:00
|
|
|
_Rb_tree&
|
|
|
|
operator=(const _Rb_tree& __x);
|
2002-03-07 07:53:23 +01:00
|
|
|
|
|
|
|
// Accessors.
|
2004-02-08 05:46:42 +01:00
|
|
|
_Compare
|
2004-02-01 12:25:21 +01:00
|
|
|
key_comp() const
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
{ return _M_impl._M_key_compare; }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
iterator
|
2004-02-01 12:25:21 +01:00
|
|
|
begin()
|
2005-09-11 11:48:41 +02:00
|
|
|
{
|
|
|
|
return iterator(static_cast<_Link_type>
|
|
|
|
(this->_M_impl._M_header._M_left));
|
|
|
|
}
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
const_iterator
|
2004-02-01 12:25:21 +01:00
|
|
|
begin() const
|
2005-09-11 11:48:41 +02:00
|
|
|
{
|
|
|
|
return const_iterator(static_cast<_Const_Link_type>
|
|
|
|
(this->_M_impl._M_header._M_left));
|
2004-10-03 17:50:32 +02:00
|
|
|
}
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
iterator
|
2004-02-01 12:25:21 +01:00
|
|
|
end()
|
2005-09-11 11:48:41 +02:00
|
|
|
{ return iterator(static_cast<_Link_type>(&this->_M_impl._M_header)); }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2003-07-04 22:37:01 +02:00
|
|
|
const_iterator
|
2004-02-01 12:25:21 +01:00
|
|
|
end() const
|
2005-09-11 11:48:41 +02:00
|
|
|
{
|
|
|
|
return const_iterator(static_cast<_Const_Link_type>
|
|
|
|
(&this->_M_impl._M_header));
|
|
|
|
}
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
reverse_iterator
|
2004-02-01 12:25:21 +01:00
|
|
|
rbegin()
|
|
|
|
{ return reverse_iterator(end()); }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
const_reverse_iterator
|
2004-02-01 12:25:21 +01:00
|
|
|
rbegin() const
|
|
|
|
{ return const_reverse_iterator(end()); }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
reverse_iterator
|
2004-02-01 12:25:21 +01:00
|
|
|
rend()
|
|
|
|
{ return reverse_iterator(begin()); }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
const_reverse_iterator
|
2004-02-01 12:25:21 +01:00
|
|
|
rend() const
|
|
|
|
{ return const_reverse_iterator(begin()); }
|
2004-02-08 05:46:42 +01:00
|
|
|
|
|
|
|
bool
|
2004-02-01 12:25:21 +01:00
|
|
|
empty() const
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
{ return _M_impl._M_node_count == 0; }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
size_type
|
2004-02-01 12:25:21 +01:00
|
|
|
size() const
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
{ return _M_impl._M_node_count; }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
size_type
|
2004-02-01 12:25:21 +01:00
|
|
|
max_size() const
|
2006-09-21 02:11:52 +02:00
|
|
|
{ return get_allocator().max_size(); }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
void
|
[multiple changes]
2007-10-04 Paolo Carlini <pcarlini@suse.de>
* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_2_neg.cc: Likewise.
2007-10-04 Chris Jefferson <chris@bubblescope.net>
Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_list.h (list<>::list(list&&),
list<>::operator=(list&&)): Add.
(list<>::swap): Adjust.
(swap(list&&, list& __y), swap(list&, list&& __y)): Add.
* include/bits/stl_vector.h (vector<>::vector(vector&&),
vector<>::operator=(vector&&)): Add.
(vector<>::swap): Adjust.
(swap(vector&&, vector& __y), swap(vector&, vector&& __y)): Add.
* include/bits/stl_bvector.h (vector<>::vector(vector&&),
vector<>::operator=(vector&&)): Add.
(vector<>::swap): Adjust.
* include/bits/stl_deque.h (deque<>::deque(deque&&),
deque<>::operator=(deque&&)): Add.
(deque<>::swap): Adjust.
(swap(deque&&, deque& __y), swap(deque&, deque&& __y)): Add.
* include/bits/stl_set.h (set<>::set(set&&),
set<>::operator=(set&&)): Add.
(set<>::swap): Adjust.
(swap(set&&, set& __y), swap(set&, set&& __y)): Add.
* include/bits/stl_map.h (map<>::map(map&&),
map<>::operator=(map&&)): Add.
(map<>::swap): Adjust.
(swap(map&&, map& __y), swap(map&, map&& __y)): Add.
* include/bits/stl_multiset.h (multiset<>::multiset(multiset&&),
multiset<>::operator=(multiset&&)): Add.
(smultiet<>::swap): Adjust.
(swap(multiset&&, multiset& __y),
swap(multiset&, multiset&& __y)): Add.
* include/bits/stl_multimap.h (multimap<>::multimap(multimap&&),
multimap<>::operator=(multimap&&)): Add.
(multimap<>::swap): Adjust.
(swap(multimap&&, multimap& __y),
swap(multimap&, multimap&& __y)): Add.
2007-10-04 Paolo Carlini <pcarlini@suse.de>
Avoid copying some allocator objects.
* include/bits/stl_list.h (_List_impl::_List_impl(),
_List_base::_List_base(), list<>::list()): Add.
* include/bits/stl_vector.h (_Vector_impl::_Vector_impl(),
_Vector_base::_Vector_base(), vector<>::vector()): Add.
* include/bits/stl_bvector.h (_Bvector_impl::_Bvector_impl(),
_Bvector_base::_Bvector_base(), vector<>::vector()): Add.
* include/bits/stl_deque.h (_Deque_impl::_Deque_impl(),
_Deque_base::_Deque_base(), deque<>::deque()): Add.
* include/bits/stl_tree.h (_Rb_tree_impl<>::_Rb_tree_impl(),
_Rb_tree_impl<>::_M_initialize): Add.
(_Rb_tree<>::_Rb_tree(const _Compare&, const allocator_type&),
_Rb_tree(const _Rb_tree&)): Adjust.
* include/bits/stl_set.h (set<>::set(),
set(_InputIterator, _InputIterator)): Use _M_t default constructor.
* include/bits/stl_map.h (map<>::map(), set(_InputIterator,
_InputIterator)): Use _M_t default constructor.
* include/bits/stl_multiset.h (multiset<>::multiset(),
multiset(_InputIterator, _InputIterator)): Use _M_t default
constructor.
* include/bits/stl_multimap.h (multimap<>::multimap(),
multimap(_InputIterator, _InputIterator)): Use _M_t default
constructor.
From-SVN: r129013
2007-10-04 17:12:34 +02:00
|
|
|
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
|
|
|
swap(_Rb_tree&& __t);
|
|
|
|
#else
|
|
|
|
swap(_Rb_tree& __t);
|
|
|
|
#endif
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2002-03-07 07:53:23 +01:00
|
|
|
// Insert/erase.
|
2006-01-06 20:11:06 +01:00
|
|
|
pair<iterator, bool>
|
|
|
|
_M_insert_unique(const value_type& __x);
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
iterator
|
2006-01-06 20:11:06 +01:00
|
|
|
_M_insert_equal(const value_type& __x);
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
iterator
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
_M_insert_unique_(const_iterator __position, const value_type& __x);
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
iterator
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
_M_insert_equal_(const_iterator __position, const value_type& __x);
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
|
2002-03-07 07:53:23 +01:00
|
|
|
template<typename _InputIterator>
|
2005-09-11 11:48:41 +02:00
|
|
|
void
|
2006-01-06 20:11:06 +01:00
|
|
|
_M_insert_unique(_InputIterator __first, _InputIterator __last);
|
2002-03-07 07:53:23 +01:00
|
|
|
|
|
|
|
template<typename _InputIterator>
|
2005-09-11 11:48:41 +02:00
|
|
|
void
|
2006-01-06 20:11:06 +01:00
|
|
|
_M_insert_equal(_InputIterator __first, _InputIterator __last);
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
void
|
2002-03-07 07:53:23 +01:00
|
|
|
erase(iterator __position);
|
|
|
|
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
void
|
|
|
|
erase(const_iterator __position);
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
size_type
|
2002-03-07 07:53:23 +01:00
|
|
|
erase(const key_type& __x);
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
void
|
2002-03-07 07:53:23 +01:00
|
|
|
erase(iterator __first, iterator __last);
|
|
|
|
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
void
|
|
|
|
erase(const_iterator __first, const_iterator __last);
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
void
|
2002-03-07 07:53:23 +01:00
|
|
|
erase(const key_type* __first, const key_type* __last);
|
|
|
|
|
2004-01-07 21:55:06 +01:00
|
|
|
void
|
|
|
|
clear()
|
2002-03-07 07:53:23 +01:00
|
|
|
{
|
2004-01-07 21:55:06 +01:00
|
|
|
_M_erase(_M_begin());
|
|
|
|
_M_leftmost() = _M_end();
|
|
|
|
_M_root() = 0;
|
|
|
|
_M_rightmost() = _M_end();
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
_M_impl._M_node_count = 0;
|
2004-01-07 21:55:06 +01:00
|
|
|
}
|
2002-03-07 07:53:23 +01:00
|
|
|
|
|
|
|
// Set operations.
|
2004-02-08 05:46:42 +01:00
|
|
|
iterator
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
find(const key_type& __k);
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
const_iterator
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
find(const key_type& __k) const;
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
size_type
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
count(const key_type& __k) const;
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
iterator
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
lower_bound(const key_type& __k)
|
re PR libstdc++/31440 (libstdc++-g++-v3 discarded qualifiers)
2007-04-03 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/31440
* include/bits/stl_tree.h (_M_lower_bound(_Link_type, _Link_type,
const _Key&), _M_upper_bound(_Link_type, _Link_type, const _Key&)):
Add.
(_M_equal_range(const _Key&) const): Remove.
(lower_bound(const key_type&), lower_bound(const key_type&) const,
upper_bound(const key_type&), upper_bound(const key_type&) const,
equal_range(const key_type&), equal_range(const key_type&) const):
Adjust.
(find(const _Key&), find(const _Key&) const): Tweak.
* testsuite/23_containers/map/operations/31440.cc: New.
From-SVN: r123452
2007-04-03 10:32:31 +02:00
|
|
|
{ return _M_lower_bound(_M_begin(), _M_end(), __k); }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
const_iterator
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
lower_bound(const key_type& __k) const
|
re PR libstdc++/31440 (libstdc++-g++-v3 discarded qualifiers)
2007-04-03 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/31440
* include/bits/stl_tree.h (_M_lower_bound(_Link_type, _Link_type,
const _Key&), _M_upper_bound(_Link_type, _Link_type, const _Key&)):
Add.
(_M_equal_range(const _Key&) const): Remove.
(lower_bound(const key_type&), lower_bound(const key_type&) const,
upper_bound(const key_type&), upper_bound(const key_type&) const,
equal_range(const key_type&), equal_range(const key_type&) const):
Adjust.
(find(const _Key&), find(const _Key&) const): Tweak.
* testsuite/23_containers/map/operations/31440.cc: New.
From-SVN: r123452
2007-04-03 10:32:31 +02:00
|
|
|
{ return _M_lower_bound(_M_begin(), _M_end(), __k); }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
iterator
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
upper_bound(const key_type& __k)
|
re PR libstdc++/31440 (libstdc++-g++-v3 discarded qualifiers)
2007-04-03 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/31440
* include/bits/stl_tree.h (_M_lower_bound(_Link_type, _Link_type,
const _Key&), _M_upper_bound(_Link_type, _Link_type, const _Key&)):
Add.
(_M_equal_range(const _Key&) const): Remove.
(lower_bound(const key_type&), lower_bound(const key_type&) const,
upper_bound(const key_type&), upper_bound(const key_type&) const,
equal_range(const key_type&), equal_range(const key_type&) const):
Adjust.
(find(const _Key&), find(const _Key&) const): Tweak.
* testsuite/23_containers/map/operations/31440.cc: New.
From-SVN: r123452
2007-04-03 10:32:31 +02:00
|
|
|
{ return _M_upper_bound(_M_begin(), _M_end(), __k); }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
const_iterator
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
upper_bound(const key_type& __k) const
|
re PR libstdc++/31440 (libstdc++-g++-v3 discarded qualifiers)
2007-04-03 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/31440
* include/bits/stl_tree.h (_M_lower_bound(_Link_type, _Link_type,
const _Key&), _M_upper_bound(_Link_type, _Link_type, const _Key&)):
Add.
(_M_equal_range(const _Key&) const): Remove.
(lower_bound(const key_type&), lower_bound(const key_type&) const,
upper_bound(const key_type&), upper_bound(const key_type&) const,
equal_range(const key_type&), equal_range(const key_type&) const):
Adjust.
(find(const _Key&), find(const _Key&) const): Tweak.
* testsuite/23_containers/map/operations/31440.cc: New.
From-SVN: r123452
2007-04-03 10:32:31 +02:00
|
|
|
{ return _M_upper_bound(_M_begin(), _M_end(), __k); }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
pair<iterator, iterator>
|
re PR libstdc++/31440 (libstdc++-g++-v3 discarded qualifiers)
2007-04-03 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/31440
* include/bits/stl_tree.h (_M_lower_bound(_Link_type, _Link_type,
const _Key&), _M_upper_bound(_Link_type, _Link_type, const _Key&)):
Add.
(_M_equal_range(const _Key&) const): Remove.
(lower_bound(const key_type&), lower_bound(const key_type&) const,
upper_bound(const key_type&), upper_bound(const key_type&) const,
equal_range(const key_type&), equal_range(const key_type&) const):
Adjust.
(find(const _Key&), find(const _Key&) const): Tweak.
* testsuite/23_containers/map/operations/31440.cc: New.
From-SVN: r123452
2007-04-03 10:32:31 +02:00
|
|
|
equal_range(const key_type& __k);
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
pair<const_iterator, const_iterator>
|
re PR libstdc++/31440 (libstdc++-g++-v3 discarded qualifiers)
2007-04-03 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/31440
* include/bits/stl_tree.h (_M_lower_bound(_Link_type, _Link_type,
const _Key&), _M_upper_bound(_Link_type, _Link_type, const _Key&)):
Add.
(_M_equal_range(const _Key&) const): Remove.
(lower_bound(const key_type&), lower_bound(const key_type&) const,
upper_bound(const key_type&), upper_bound(const key_type&) const,
equal_range(const key_type&), equal_range(const key_type&) const):
Adjust.
(find(const _Key&), find(const _Key&) const): Tweak.
* testsuite/23_containers/map/operations/31440.cc: New.
From-SVN: r123452
2007-04-03 10:32:31 +02:00
|
|
|
equal_range(const key_type& __k) const;
|
2002-03-07 07:53:23 +01:00
|
|
|
|
|
|
|
// Debugging.
|
2004-02-08 05:46:42 +01:00
|
|
|
bool
|
2002-03-07 07:53:23 +01:00
|
|
|
__rb_verify() const;
|
|
|
|
};
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
2002-03-07 07:53:23 +01:00
|
|
|
typename _Compare, typename _Alloc>
|
2004-02-08 05:46:42 +01:00
|
|
|
inline bool
|
2004-10-03 17:50:32 +02:00
|
|
|
operator==(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
|
|
|
|
const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
|
2002-03-07 07:53:23 +01:00
|
|
|
{
|
2004-02-01 12:25:21 +01:00
|
|
|
return __x.size() == __y.size()
|
2005-01-17 15:14:26 +01:00
|
|
|
&& std::equal(__x.begin(), __x.end(), __y.begin());
|
2000-10-05 13:27:02 +02:00
|
|
|
}
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
2002-03-07 07:53:23 +01:00
|
|
|
typename _Compare, typename _Alloc>
|
2004-02-08 05:46:42 +01:00
|
|
|
inline bool
|
2004-10-03 17:50:32 +02:00
|
|
|
operator<(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
|
|
|
|
const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
|
2002-03-07 07:53:23 +01:00
|
|
|
{
|
2005-01-17 15:14:26 +01:00
|
|
|
return std::lexicographical_compare(__x.begin(), __x.end(),
|
|
|
|
__y.begin(), __y.end());
|
2000-10-05 13:27:02 +02:00
|
|
|
}
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
2002-03-07 07:53:23 +01:00
|
|
|
typename _Compare, typename _Alloc>
|
2004-02-08 05:46:42 +01:00
|
|
|
inline bool
|
2004-10-03 17:50:32 +02:00
|
|
|
operator!=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
|
|
|
|
const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
|
2002-03-07 07:53:23 +01:00
|
|
|
{ return !(__x == __y); }
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
2002-03-07 07:53:23 +01:00
|
|
|
typename _Compare, typename _Alloc>
|
2004-02-08 05:46:42 +01:00
|
|
|
inline bool
|
2004-10-03 17:50:32 +02:00
|
|
|
operator>(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
|
|
|
|
const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
|
2002-03-07 07:53:23 +01:00
|
|
|
{ return __y < __x; }
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
2002-03-07 07:53:23 +01:00
|
|
|
typename _Compare, typename _Alloc>
|
2004-02-08 05:46:42 +01:00
|
|
|
inline bool
|
2004-10-03 17:50:32 +02:00
|
|
|
operator<=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
|
|
|
|
const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
|
2004-02-02 00:19:55 +01:00
|
|
|
{ return !(__y < __x); }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
2002-03-07 07:53:23 +01:00
|
|
|
typename _Compare, typename _Alloc>
|
2004-02-08 05:46:42 +01:00
|
|
|
inline bool
|
2004-10-03 17:50:32 +02:00
|
|
|
operator>=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
|
|
|
|
const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
|
2004-02-02 00:19:55 +01:00
|
|
|
{ return !(__x < __y); }
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
2002-03-07 07:53:23 +01:00
|
|
|
typename _Compare, typename _Alloc>
|
2004-02-08 05:46:42 +01:00
|
|
|
inline void
|
2004-10-03 17:50:32 +02:00
|
|
|
swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
|
|
|
|
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
|
2002-03-07 07:53:23 +01:00
|
|
|
{ __x.swap(__y); }
|
|
|
|
|
2007-10-16 17:20:09 +02:00
|
|
|
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
|
|
|
typename _Compare, typename _Alloc>
|
|
|
|
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
|
|
|
|
_Rb_tree(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&& __x)
|
|
|
|
: _M_impl(__x._M_impl._M_key_compare, __x._M_get_Node_allocator())
|
|
|
|
{
|
|
|
|
if (__x._M_root() != 0)
|
|
|
|
{
|
|
|
|
_M_root() = __x._M_root();
|
|
|
|
_M_leftmost() = __x._M_leftmost();
|
|
|
|
_M_rightmost() = __x._M_rightmost();
|
|
|
|
_M_root()->_M_parent = _M_end();
|
|
|
|
|
|
|
|
__x._M_root() = 0;
|
|
|
|
__x._M_leftmost() = __x._M_end();
|
|
|
|
__x._M_rightmost() = __x._M_end();
|
|
|
|
|
|
|
|
this->_M_impl._M_node_count = __x._M_impl._M_node_count;
|
|
|
|
__x._M_impl._M_node_count = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
2002-03-07 07:53:23 +01:00
|
|
|
typename _Compare, typename _Alloc>
|
2004-10-03 17:50:32 +02:00
|
|
|
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&
|
|
|
|
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
|
|
|
|
operator=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x)
|
2002-03-07 07:53:23 +01:00
|
|
|
{
|
2004-02-08 05:46:42 +01:00
|
|
|
if (this != &__x)
|
2002-03-07 07:53:23 +01:00
|
|
|
{
|
|
|
|
// Note that _Key may be a constant type.
|
|
|
|
clear();
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
_M_impl._M_key_compare = __x._M_impl._M_key_compare;
|
2004-02-08 05:46:42 +01:00
|
|
|
if (__x._M_root() != 0)
|
2002-03-07 07:53:23 +01:00
|
|
|
{
|
2003-07-30 17:01:58 +02:00
|
|
|
_M_root() = _M_copy(__x._M_begin(), _M_end());
|
2002-03-07 07:53:23 +01:00
|
|
|
_M_leftmost() = _S_minimum(_M_root());
|
|
|
|
_M_rightmost() = _S_maximum(_M_root());
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
_M_impl._M_node_count = __x._M_impl._M_node_count;
|
2002-03-07 07:53:23 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return *this;
|
2000-10-05 13:27:02 +02:00
|
|
|
}
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
2002-03-07 07:53:23 +01:00
|
|
|
typename _Compare, typename _Alloc>
|
2004-10-03 17:50:32 +02:00
|
|
|
typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
|
|
|
|
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
_M_insert_(_Const_Base_ptr __x, _Const_Base_ptr __p, const _Val& __v)
|
2002-03-07 07:53:23 +01:00
|
|
|
{
|
2005-02-27 00:34:36 +01:00
|
|
|
bool __insert_left = (__x != 0 || __p == _M_end()
|
|
|
|
|| _M_impl._M_key_compare(_KeyOfValue()(__v),
|
|
|
|
_S_key(__p)));
|
2004-01-07 21:55:06 +01:00
|
|
|
|
2005-02-27 00:34:36 +01:00
|
|
|
_Link_type __z = _M_create_node(__v);
|
2004-01-07 21:55:06 +01:00
|
|
|
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
_Rb_tree_insert_and_rebalance(__insert_left, __z,
|
|
|
|
const_cast<_Base_ptr>(__p),
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
this->_M_impl._M_header);
|
|
|
|
++_M_impl._M_node_count;
|
2002-03-07 07:53:23 +01:00
|
|
|
return iterator(__z);
|
|
|
|
}
|
|
|
|
|
2006-01-08 18:34:32 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
|
|
|
typename _Compare, typename _Alloc>
|
|
|
|
typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
|
|
|
|
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
|
|
|
|
_M_insert_lower(_Base_ptr __x, _Base_ptr __p, const _Val& __v)
|
|
|
|
{
|
|
|
|
bool __insert_left = (__x != 0 || __p == _M_end()
|
|
|
|
|| !_M_impl._M_key_compare(_S_key(__p),
|
|
|
|
_KeyOfValue()(__v)));
|
|
|
|
|
|
|
|
_Link_type __z = _M_create_node(__v);
|
|
|
|
|
|
|
|
_Rb_tree_insert_and_rebalance(__insert_left, __z, __p,
|
|
|
|
this->_M_impl._M_header);
|
|
|
|
++_M_impl._M_node_count;
|
|
|
|
return iterator(__z);
|
|
|
|
}
|
|
|
|
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
|
|
|
typename _Compare, typename _Alloc>
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
_M_insert_equal_lower(const _Val& __v)
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
{
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
_Link_type __x = _M_begin();
|
|
|
|
_Link_type __y = _M_end();
|
|
|
|
while (__x != 0)
|
|
|
|
{
|
|
|
|
__y = __x;
|
|
|
|
__x = !_M_impl._M_key_compare(_S_key(__x), _KeyOfValue()(__v)) ?
|
|
|
|
_S_left(__x) : _S_right(__x);
|
|
|
|
}
|
|
|
|
return _M_insert_lower(__x, __y, __v);
|
|
|
|
}
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KoV,
|
|
|
|
typename _Compare, typename _Alloc>
|
|
|
|
typename _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>::_Link_type
|
|
|
|
_Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>::
|
|
|
|
_M_copy(_Const_Link_type __x, _Link_type __p)
|
|
|
|
{
|
|
|
|
// Structural copy. __x and __p must be non-null.
|
|
|
|
_Link_type __top = _M_clone_node(__x);
|
|
|
|
__top->_M_parent = __p;
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
try
|
|
|
|
{
|
|
|
|
if (__x->_M_right)
|
|
|
|
__top->_M_right = _M_copy(_S_right(__x), __top);
|
|
|
|
__p = __top;
|
|
|
|
__x = _S_left(__x);
|
|
|
|
|
|
|
|
while (__x != 0)
|
|
|
|
{
|
|
|
|
_Link_type __y = _M_clone_node(__x);
|
|
|
|
__p->_M_left = __y;
|
|
|
|
__y->_M_parent = __p;
|
|
|
|
if (__x->_M_right)
|
|
|
|
__y->_M_right = _M_copy(_S_right(__x), __y);
|
|
|
|
__p = __y;
|
|
|
|
__x = _S_left(__x);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(...)
|
|
|
|
{
|
|
|
|
_M_erase(__top);
|
|
|
|
__throw_exception_again;
|
|
|
|
}
|
|
|
|
return __top;
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
}
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
2002-03-07 07:53:23 +01:00
|
|
|
typename _Compare, typename _Alloc>
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
void
|
2004-10-03 17:50:32 +02:00
|
|
|
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
_M_erase(_Link_type __x)
|
2002-03-07 07:53:23 +01:00
|
|
|
{
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
// Erase without rebalancing.
|
2004-02-08 05:46:42 +01:00
|
|
|
while (__x != 0)
|
2002-03-07 07:53:23 +01:00
|
|
|
{
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
_M_erase(_S_right(__x));
|
|
|
|
_Link_type __y = _S_left(__x);
|
|
|
|
_M_destroy_node(__x);
|
|
|
|
__x = __y;
|
2002-03-07 07:53:23 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-08 18:34:32 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
|
|
|
typename _Compare, typename _Alloc>
|
re PR libstdc++/31440 (libstdc++-g++-v3 discarded qualifiers)
2007-04-03 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/31440
* include/bits/stl_tree.h (_M_lower_bound(_Link_type, _Link_type,
const _Key&), _M_upper_bound(_Link_type, _Link_type, const _Key&)):
Add.
(_M_equal_range(const _Key&) const): Remove.
(lower_bound(const key_type&), lower_bound(const key_type&) const,
upper_bound(const key_type&), upper_bound(const key_type&) const,
equal_range(const key_type&), equal_range(const key_type&) const):
Adjust.
(find(const _Key&), find(const _Key&) const): Tweak.
* testsuite/23_containers/map/operations/31440.cc: New.
From-SVN: r123452
2007-04-03 10:32:31 +02:00
|
|
|
typename _Rb_tree<_Key, _Val, _KeyOfValue,
|
|
|
|
_Compare, _Alloc>::iterator
|
|
|
|
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
|
|
|
|
_M_lower_bound(_Link_type __x, _Link_type __y,
|
|
|
|
const _Key& __k)
|
|
|
|
{
|
|
|
|
while (__x != 0)
|
|
|
|
if (!_M_impl._M_key_compare(_S_key(__x), __k))
|
|
|
|
__y = __x, __x = _S_left(__x);
|
|
|
|
else
|
|
|
|
__x = _S_right(__x);
|
|
|
|
return iterator(__y);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
|
|
|
typename _Compare, typename _Alloc>
|
|
|
|
typename _Rb_tree<_Key, _Val, _KeyOfValue,
|
|
|
|
_Compare, _Alloc>::const_iterator
|
2006-01-08 18:34:32 +01:00
|
|
|
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
_M_lower_bound(_Const_Link_type __x, _Const_Link_type __y,
|
|
|
|
const _Key& __k) const
|
2006-01-08 18:34:32 +01:00
|
|
|
{
|
|
|
|
while (__x != 0)
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
if (!_M_impl._M_key_compare(_S_key(__x), __k))
|
|
|
|
__y = __x, __x = _S_left(__x);
|
|
|
|
else
|
|
|
|
__x = _S_right(__x);
|
re PR libstdc++/31440 (libstdc++-g++-v3 discarded qualifiers)
2007-04-03 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/31440
* include/bits/stl_tree.h (_M_lower_bound(_Link_type, _Link_type,
const _Key&), _M_upper_bound(_Link_type, _Link_type, const _Key&)):
Add.
(_M_equal_range(const _Key&) const): Remove.
(lower_bound(const key_type&), lower_bound(const key_type&) const,
upper_bound(const key_type&), upper_bound(const key_type&) const,
equal_range(const key_type&), equal_range(const key_type&) const):
Adjust.
(find(const _Key&), find(const _Key&) const): Tweak.
* testsuite/23_containers/map/operations/31440.cc: New.
From-SVN: r123452
2007-04-03 10:32:31 +02:00
|
|
|
return const_iterator(__y);
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
|
|
|
typename _Compare, typename _Alloc>
|
re PR libstdc++/31440 (libstdc++-g++-v3 discarded qualifiers)
2007-04-03 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/31440
* include/bits/stl_tree.h (_M_lower_bound(_Link_type, _Link_type,
const _Key&), _M_upper_bound(_Link_type, _Link_type, const _Key&)):
Add.
(_M_equal_range(const _Key&) const): Remove.
(lower_bound(const key_type&), lower_bound(const key_type&) const,
upper_bound(const key_type&), upper_bound(const key_type&) const,
equal_range(const key_type&), equal_range(const key_type&) const):
Adjust.
(find(const _Key&), find(const _Key&) const): Tweak.
* testsuite/23_containers/map/operations/31440.cc: New.
From-SVN: r123452
2007-04-03 10:32:31 +02:00
|
|
|
typename _Rb_tree<_Key, _Val, _KeyOfValue,
|
|
|
|
_Compare, _Alloc>::iterator
|
|
|
|
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
|
|
|
|
_M_upper_bound(_Link_type __x, _Link_type __y,
|
|
|
|
const _Key& __k)
|
|
|
|
{
|
|
|
|
while (__x != 0)
|
|
|
|
if (_M_impl._M_key_compare(__k, _S_key(__x)))
|
|
|
|
__y = __x, __x = _S_left(__x);
|
|
|
|
else
|
|
|
|
__x = _S_right(__x);
|
|
|
|
return iterator(__y);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
|
|
|
typename _Compare, typename _Alloc>
|
|
|
|
typename _Rb_tree<_Key, _Val, _KeyOfValue,
|
|
|
|
_Compare, _Alloc>::const_iterator
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
|
|
|
|
_M_upper_bound(_Const_Link_type __x, _Const_Link_type __y,
|
|
|
|
const _Key& __k) const
|
|
|
|
{
|
|
|
|
while (__x != 0)
|
|
|
|
if (_M_impl._M_key_compare(__k, _S_key(__x)))
|
|
|
|
__y = __x, __x = _S_left(__x);
|
|
|
|
else
|
|
|
|
__x = _S_right(__x);
|
re PR libstdc++/31440 (libstdc++-g++-v3 discarded qualifiers)
2007-04-03 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/31440
* include/bits/stl_tree.h (_M_lower_bound(_Link_type, _Link_type,
const _Key&), _M_upper_bound(_Link_type, _Link_type, const _Key&)):
Add.
(_M_equal_range(const _Key&) const): Remove.
(lower_bound(const key_type&), lower_bound(const key_type&) const,
upper_bound(const key_type&), upper_bound(const key_type&) const,
equal_range(const key_type&), equal_range(const key_type&) const):
Adjust.
(find(const _Key&), find(const _Key&) const): Tweak.
* testsuite/23_containers/map/operations/31440.cc: New.
From-SVN: r123452
2007-04-03 10:32:31 +02:00
|
|
|
return const_iterator(__y);
|
2006-01-08 18:34:32 +01:00
|
|
|
}
|
|
|
|
|
2006-11-26 11:04:25 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
|
|
|
typename _Compare, typename _Alloc>
|
|
|
|
pair<typename _Rb_tree<_Key, _Val, _KeyOfValue,
|
|
|
|
_Compare, _Alloc>::iterator,
|
re PR libstdc++/31440 (libstdc++-g++-v3 discarded qualifiers)
2007-04-03 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/31440
* include/bits/stl_tree.h (_M_lower_bound(_Link_type, _Link_type,
const _Key&), _M_upper_bound(_Link_type, _Link_type, const _Key&)):
Add.
(_M_equal_range(const _Key&) const): Remove.
(lower_bound(const key_type&), lower_bound(const key_type&) const,
upper_bound(const key_type&), upper_bound(const key_type&) const,
equal_range(const key_type&), equal_range(const key_type&) const):
Adjust.
(find(const _Key&), find(const _Key&) const): Tweak.
* testsuite/23_containers/map/operations/31440.cc: New.
From-SVN: r123452
2007-04-03 10:32:31 +02:00
|
|
|
typename _Rb_tree<_Key, _Val, _KeyOfValue,
|
|
|
|
_Compare, _Alloc>::iterator>
|
|
|
|
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
|
|
|
|
equal_range(const _Key& __k)
|
|
|
|
{
|
|
|
|
_Link_type __x = _M_begin();
|
|
|
|
_Link_type __y = _M_end();
|
|
|
|
while (__x != 0)
|
|
|
|
{
|
|
|
|
if (_M_impl._M_key_compare(_S_key(__x), __k))
|
|
|
|
__x = _S_right(__x);
|
|
|
|
else if (_M_impl._M_key_compare(__k, _S_key(__x)))
|
|
|
|
__y = __x, __x = _S_left(__x);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_Link_type __xu(__x), __yu(__y);
|
|
|
|
__y = __x, __x = _S_left(__x);
|
|
|
|
__xu = _S_right(__xu);
|
|
|
|
return pair<iterator,
|
|
|
|
iterator>(_M_lower_bound(__x, __y, __k),
|
|
|
|
_M_upper_bound(__xu, __yu, __k));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return pair<iterator, iterator>(iterator(__y),
|
|
|
|
iterator(__y));
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
|
|
|
typename _Compare, typename _Alloc>
|
|
|
|
pair<typename _Rb_tree<_Key, _Val, _KeyOfValue,
|
|
|
|
_Compare, _Alloc>::const_iterator,
|
|
|
|
typename _Rb_tree<_Key, _Val, _KeyOfValue,
|
|
|
|
_Compare, _Alloc>::const_iterator>
|
2006-11-26 11:04:25 +01:00
|
|
|
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
|
re PR libstdc++/31440 (libstdc++-g++-v3 discarded qualifiers)
2007-04-03 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/31440
* include/bits/stl_tree.h (_M_lower_bound(_Link_type, _Link_type,
const _Key&), _M_upper_bound(_Link_type, _Link_type, const _Key&)):
Add.
(_M_equal_range(const _Key&) const): Remove.
(lower_bound(const key_type&), lower_bound(const key_type&) const,
upper_bound(const key_type&), upper_bound(const key_type&) const,
equal_range(const key_type&), equal_range(const key_type&) const):
Adjust.
(find(const _Key&), find(const _Key&) const): Tweak.
* testsuite/23_containers/map/operations/31440.cc: New.
From-SVN: r123452
2007-04-03 10:32:31 +02:00
|
|
|
equal_range(const _Key& __k) const
|
2006-11-26 11:04:25 +01:00
|
|
|
{
|
|
|
|
_Const_Link_type __x = _M_begin();
|
|
|
|
_Const_Link_type __y = _M_end();
|
|
|
|
while (__x != 0)
|
|
|
|
{
|
|
|
|
if (_M_impl._M_key_compare(_S_key(__x), __k))
|
|
|
|
__x = _S_right(__x);
|
|
|
|
else if (_M_impl._M_key_compare(__k, _S_key(__x)))
|
|
|
|
__y = __x, __x = _S_left(__x);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_Const_Link_type __xu(__x), __yu(__y);
|
|
|
|
__y = __x, __x = _S_left(__x);
|
|
|
|
__xu = _S_right(__xu);
|
re PR libstdc++/31440 (libstdc++-g++-v3 discarded qualifiers)
2007-04-03 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/31440
* include/bits/stl_tree.h (_M_lower_bound(_Link_type, _Link_type,
const _Key&), _M_upper_bound(_Link_type, _Link_type, const _Key&)):
Add.
(_M_equal_range(const _Key&) const): Remove.
(lower_bound(const key_type&), lower_bound(const key_type&) const,
upper_bound(const key_type&), upper_bound(const key_type&) const,
equal_range(const key_type&), equal_range(const key_type&) const):
Adjust.
(find(const _Key&), find(const _Key&) const): Tweak.
* testsuite/23_containers/map/operations/31440.cc: New.
From-SVN: r123452
2007-04-03 10:32:31 +02:00
|
|
|
return pair<const_iterator,
|
|
|
|
const_iterator>(_M_lower_bound(__x, __y, __k),
|
|
|
|
_M_upper_bound(__xu, __yu, __k));
|
2006-11-26 11:04:25 +01:00
|
|
|
}
|
|
|
|
}
|
re PR libstdc++/31440 (libstdc++-g++-v3 discarded qualifiers)
2007-04-03 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/31440
* include/bits/stl_tree.h (_M_lower_bound(_Link_type, _Link_type,
const _Key&), _M_upper_bound(_Link_type, _Link_type, const _Key&)):
Add.
(_M_equal_range(const _Key&) const): Remove.
(lower_bound(const key_type&), lower_bound(const key_type&) const,
upper_bound(const key_type&), upper_bound(const key_type&) const,
equal_range(const key_type&), equal_range(const key_type&) const):
Adjust.
(find(const _Key&), find(const _Key&) const): Tweak.
* testsuite/23_containers/map/operations/31440.cc: New.
From-SVN: r123452
2007-04-03 10:32:31 +02:00
|
|
|
return pair<const_iterator, const_iterator>(const_iterator(__y),
|
|
|
|
const_iterator(__y));
|
2006-11-26 11:04:25 +01:00
|
|
|
}
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
2003-07-04 22:37:01 +02:00
|
|
|
typename _Compare, typename _Alloc>
|
|
|
|
void
|
2004-10-03 17:50:32 +02:00
|
|
|
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
|
[multiple changes]
2007-10-04 Paolo Carlini <pcarlini@suse.de>
* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_2_neg.cc: Likewise.
2007-10-04 Chris Jefferson <chris@bubblescope.net>
Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_list.h (list<>::list(list&&),
list<>::operator=(list&&)): Add.
(list<>::swap): Adjust.
(swap(list&&, list& __y), swap(list&, list&& __y)): Add.
* include/bits/stl_vector.h (vector<>::vector(vector&&),
vector<>::operator=(vector&&)): Add.
(vector<>::swap): Adjust.
(swap(vector&&, vector& __y), swap(vector&, vector&& __y)): Add.
* include/bits/stl_bvector.h (vector<>::vector(vector&&),
vector<>::operator=(vector&&)): Add.
(vector<>::swap): Adjust.
* include/bits/stl_deque.h (deque<>::deque(deque&&),
deque<>::operator=(deque&&)): Add.
(deque<>::swap): Adjust.
(swap(deque&&, deque& __y), swap(deque&, deque&& __y)): Add.
* include/bits/stl_set.h (set<>::set(set&&),
set<>::operator=(set&&)): Add.
(set<>::swap): Adjust.
(swap(set&&, set& __y), swap(set&, set&& __y)): Add.
* include/bits/stl_map.h (map<>::map(map&&),
map<>::operator=(map&&)): Add.
(map<>::swap): Adjust.
(swap(map&&, map& __y), swap(map&, map&& __y)): Add.
* include/bits/stl_multiset.h (multiset<>::multiset(multiset&&),
multiset<>::operator=(multiset&&)): Add.
(smultiet<>::swap): Adjust.
(swap(multiset&&, multiset& __y),
swap(multiset&, multiset&& __y)): Add.
* include/bits/stl_multimap.h (multimap<>::multimap(multimap&&),
multimap<>::operator=(multimap&&)): Add.
(multimap<>::swap): Adjust.
(swap(multimap&&, multimap& __y),
swap(multimap&, multimap&& __y)): Add.
2007-10-04 Paolo Carlini <pcarlini@suse.de>
Avoid copying some allocator objects.
* include/bits/stl_list.h (_List_impl::_List_impl(),
_List_base::_List_base(), list<>::list()): Add.
* include/bits/stl_vector.h (_Vector_impl::_Vector_impl(),
_Vector_base::_Vector_base(), vector<>::vector()): Add.
* include/bits/stl_bvector.h (_Bvector_impl::_Bvector_impl(),
_Bvector_base::_Bvector_base(), vector<>::vector()): Add.
* include/bits/stl_deque.h (_Deque_impl::_Deque_impl(),
_Deque_base::_Deque_base(), deque<>::deque()): Add.
* include/bits/stl_tree.h (_Rb_tree_impl<>::_Rb_tree_impl(),
_Rb_tree_impl<>::_M_initialize): Add.
(_Rb_tree<>::_Rb_tree(const _Compare&, const allocator_type&),
_Rb_tree(const _Rb_tree&)): Adjust.
* include/bits/stl_set.h (set<>::set(),
set(_InputIterator, _InputIterator)): Use _M_t default constructor.
* include/bits/stl_map.h (map<>::map(), set(_InputIterator,
_InputIterator)): Use _M_t default constructor.
* include/bits/stl_multiset.h (multiset<>::multiset(),
multiset(_InputIterator, _InputIterator)): Use _M_t default
constructor.
* include/bits/stl_multimap.h (multimap<>::multimap(),
multimap(_InputIterator, _InputIterator)): Use _M_t default
constructor.
From-SVN: r129013
2007-10-04 17:12:34 +02:00
|
|
|
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
|
|
|
swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&& __t)
|
|
|
|
#else
|
2004-10-03 17:50:32 +02:00
|
|
|
swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __t)
|
[multiple changes]
2007-10-04 Paolo Carlini <pcarlini@suse.de>
* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_2_neg.cc: Likewise.
2007-10-04 Chris Jefferson <chris@bubblescope.net>
Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_list.h (list<>::list(list&&),
list<>::operator=(list&&)): Add.
(list<>::swap): Adjust.
(swap(list&&, list& __y), swap(list&, list&& __y)): Add.
* include/bits/stl_vector.h (vector<>::vector(vector&&),
vector<>::operator=(vector&&)): Add.
(vector<>::swap): Adjust.
(swap(vector&&, vector& __y), swap(vector&, vector&& __y)): Add.
* include/bits/stl_bvector.h (vector<>::vector(vector&&),
vector<>::operator=(vector&&)): Add.
(vector<>::swap): Adjust.
* include/bits/stl_deque.h (deque<>::deque(deque&&),
deque<>::operator=(deque&&)): Add.
(deque<>::swap): Adjust.
(swap(deque&&, deque& __y), swap(deque&, deque&& __y)): Add.
* include/bits/stl_set.h (set<>::set(set&&),
set<>::operator=(set&&)): Add.
(set<>::swap): Adjust.
(swap(set&&, set& __y), swap(set&, set&& __y)): Add.
* include/bits/stl_map.h (map<>::map(map&&),
map<>::operator=(map&&)): Add.
(map<>::swap): Adjust.
(swap(map&&, map& __y), swap(map&, map&& __y)): Add.
* include/bits/stl_multiset.h (multiset<>::multiset(multiset&&),
multiset<>::operator=(multiset&&)): Add.
(smultiet<>::swap): Adjust.
(swap(multiset&&, multiset& __y),
swap(multiset&, multiset&& __y)): Add.
* include/bits/stl_multimap.h (multimap<>::multimap(multimap&&),
multimap<>::operator=(multimap&&)): Add.
(multimap<>::swap): Adjust.
(swap(multimap&&, multimap& __y),
swap(multimap&, multimap&& __y)): Add.
2007-10-04 Paolo Carlini <pcarlini@suse.de>
Avoid copying some allocator objects.
* include/bits/stl_list.h (_List_impl::_List_impl(),
_List_base::_List_base(), list<>::list()): Add.
* include/bits/stl_vector.h (_Vector_impl::_Vector_impl(),
_Vector_base::_Vector_base(), vector<>::vector()): Add.
* include/bits/stl_bvector.h (_Bvector_impl::_Bvector_impl(),
_Bvector_base::_Bvector_base(), vector<>::vector()): Add.
* include/bits/stl_deque.h (_Deque_impl::_Deque_impl(),
_Deque_base::_Deque_base(), deque<>::deque()): Add.
* include/bits/stl_tree.h (_Rb_tree_impl<>::_Rb_tree_impl(),
_Rb_tree_impl<>::_M_initialize): Add.
(_Rb_tree<>::_Rb_tree(const _Compare&, const allocator_type&),
_Rb_tree(const _Rb_tree&)): Adjust.
* include/bits/stl_set.h (set<>::set(),
set(_InputIterator, _InputIterator)): Use _M_t default constructor.
* include/bits/stl_map.h (map<>::map(), set(_InputIterator,
_InputIterator)): Use _M_t default constructor.
* include/bits/stl_multiset.h (multiset<>::multiset(),
multiset(_InputIterator, _InputIterator)): Use _M_t default
constructor.
* include/bits/stl_multimap.h (multimap<>::multimap(),
multimap(_InputIterator, _InputIterator)): Use _M_t default
constructor.
From-SVN: r129013
2007-10-04 17:12:34 +02:00
|
|
|
#endif
|
2003-07-04 22:37:01 +02:00
|
|
|
{
|
|
|
|
if (_M_root() == 0)
|
|
|
|
{
|
2006-01-06 20:11:06 +01:00
|
|
|
if (__t._M_root() != 0)
|
|
|
|
{
|
|
|
|
_M_root() = __t._M_root();
|
|
|
|
_M_leftmost() = __t._M_leftmost();
|
|
|
|
_M_rightmost() = __t._M_rightmost();
|
|
|
|
_M_root()->_M_parent = _M_end();
|
|
|
|
|
|
|
|
__t._M_root() = 0;
|
|
|
|
__t._M_leftmost() = __t._M_end();
|
|
|
|
__t._M_rightmost() = __t._M_end();
|
|
|
|
}
|
2003-07-04 22:37:01 +02:00
|
|
|
}
|
|
|
|
else if (__t._M_root() == 0)
|
2006-01-06 20:11:06 +01:00
|
|
|
{
|
|
|
|
__t._M_root() = _M_root();
|
|
|
|
__t._M_leftmost() = _M_leftmost();
|
|
|
|
__t._M_rightmost() = _M_rightmost();
|
|
|
|
__t._M_root()->_M_parent = __t._M_end();
|
|
|
|
|
|
|
|
_M_root() = 0;
|
|
|
|
_M_leftmost() = _M_end();
|
|
|
|
_M_rightmost() = _M_end();
|
|
|
|
}
|
2003-07-04 22:37:01 +02:00
|
|
|
else
|
2006-01-06 20:11:06 +01:00
|
|
|
{
|
|
|
|
std::swap(_M_root(),__t._M_root());
|
|
|
|
std::swap(_M_leftmost(),__t._M_leftmost());
|
|
|
|
std::swap(_M_rightmost(),__t._M_rightmost());
|
|
|
|
|
|
|
|
_M_root()->_M_parent = _M_end();
|
|
|
|
__t._M_root()->_M_parent = __t._M_end();
|
|
|
|
}
|
2003-07-04 22:37:01 +02:00
|
|
|
// No need to swap header's color as it does not change.
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
std::swap(this->_M_impl._M_node_count, __t._M_impl._M_node_count);
|
|
|
|
std::swap(this->_M_impl._M_key_compare, __t._M_impl._M_key_compare);
|
2006-01-06 20:11:06 +01:00
|
|
|
|
2006-01-04 12:34:45 +01:00
|
|
|
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
|
|
|
// 431. Swapping containers with unequal allocators.
|
|
|
|
std::__alloc_swap<_Node_allocator>::
|
|
|
|
_S_do_it(_M_get_Node_allocator(), __t._M_get_Node_allocator());
|
2003-07-04 22:37:01 +02:00
|
|
|
}
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
2002-03-07 07:53:23 +01:00
|
|
|
typename _Compare, typename _Alloc>
|
2004-10-03 17:50:32 +02:00
|
|
|
pair<typename _Rb_tree<_Key, _Val, _KeyOfValue,
|
|
|
|
_Compare, _Alloc>::iterator, bool>
|
|
|
|
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
|
2006-01-06 20:11:06 +01:00
|
|
|
_M_insert_unique(const _Val& __v)
|
2002-03-07 07:53:23 +01:00
|
|
|
{
|
2003-07-30 17:01:58 +02:00
|
|
|
_Link_type __x = _M_begin();
|
2003-07-04 22:37:01 +02:00
|
|
|
_Link_type __y = _M_end();
|
2002-03-07 07:53:23 +01:00
|
|
|
bool __comp = true;
|
2004-02-01 12:25:21 +01:00
|
|
|
while (__x != 0)
|
2002-03-07 07:53:23 +01:00
|
|
|
{
|
|
|
|
__y = __x;
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
__comp = _M_impl._M_key_compare(_KeyOfValue()(__v), _S_key(__x));
|
2002-03-07 07:53:23 +01:00
|
|
|
__x = __comp ? _S_left(__x) : _S_right(__x);
|
|
|
|
}
|
2004-02-01 12:25:21 +01:00
|
|
|
iterator __j = iterator(__y);
|
2002-03-07 07:53:23 +01:00
|
|
|
if (__comp)
|
2006-12-14 06:49:06 +01:00
|
|
|
{
|
|
|
|
if (__j == begin())
|
|
|
|
return pair<iterator, bool>(_M_insert_(__x, __y, __v), true);
|
|
|
|
else
|
|
|
|
--__j;
|
|
|
|
}
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
if (_M_impl._M_key_compare(_S_key(__j._M_node), _KeyOfValue()(__v)))
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
return pair<iterator, bool>(_M_insert_(__x, __y, __v), true);
|
2004-10-03 17:50:32 +02:00
|
|
|
return pair<iterator, bool>(__j, false);
|
2002-03-07 07:53:23 +01:00
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
2002-03-07 07:53:23 +01:00
|
|
|
typename _Compare, typename _Alloc>
|
2004-02-08 05:46:42 +01:00
|
|
|
typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
|
2002-03-07 07:53:23 +01:00
|
|
|
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
_M_insert_equal(const _Val& __v)
|
2002-03-07 07:53:23 +01:00
|
|
|
{
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
_Link_type __x = _M_begin();
|
|
|
|
_Link_type __y = _M_end();
|
|
|
|
while (__x != 0)
|
2005-06-27 18:35:49 +02:00
|
|
|
{
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
__y = __x;
|
|
|
|
__x = _M_impl._M_key_compare(_KeyOfValue()(__v), _S_key(__x)) ?
|
|
|
|
_S_left(__x) : _S_right(__x);
|
2002-03-07 07:53:23 +01:00
|
|
|
}
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
return _M_insert_(__x, __y, __v);
|
2000-10-05 13:27:02 +02:00
|
|
|
}
|
2002-03-07 07:53:23 +01:00
|
|
|
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
|
|
|
typename _Compare, typename _Alloc>
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
_M_insert_unique_(const_iterator __position, const _Val& __v)
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
{
|
|
|
|
// end()
|
|
|
|
if (__position._M_node == _M_end())
|
|
|
|
{
|
|
|
|
if (size() > 0
|
|
|
|
&& _M_impl._M_key_compare(_S_key(_M_rightmost()),
|
|
|
|
_KeyOfValue()(__v)))
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
return _M_insert_(0, _M_rightmost(), __v);
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
else
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
return _M_insert_unique(__v).first;
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
}
|
|
|
|
else if (_M_impl._M_key_compare(_KeyOfValue()(__v),
|
|
|
|
_S_key(__position._M_node)))
|
|
|
|
{
|
|
|
|
// First, try before...
|
|
|
|
const_iterator __before = __position;
|
|
|
|
if (__position._M_node == _M_leftmost()) // begin()
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
return _M_insert_(_M_leftmost(), _M_leftmost(), __v);
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
else if (_M_impl._M_key_compare(_S_key((--__before)._M_node),
|
|
|
|
_KeyOfValue()(__v)))
|
|
|
|
{
|
|
|
|
if (_S_right(__before._M_node) == 0)
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
return _M_insert_(0, __before._M_node, __v);
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
else
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
return _M_insert_(__position._M_node,
|
|
|
|
__position._M_node, __v);
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
}
|
|
|
|
else
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
return _M_insert_unique(__v).first;
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
}
|
|
|
|
else if (_M_impl._M_key_compare(_S_key(__position._M_node),
|
|
|
|
_KeyOfValue()(__v)))
|
|
|
|
{
|
|
|
|
// ... then try after.
|
|
|
|
const_iterator __after = __position;
|
|
|
|
if (__position._M_node == _M_rightmost())
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
return _M_insert_(0, _M_rightmost(), __v);
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
else if (_M_impl._M_key_compare(_KeyOfValue()(__v),
|
|
|
|
_S_key((++__after)._M_node)))
|
|
|
|
{
|
|
|
|
if (_S_right(__position._M_node) == 0)
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
return _M_insert_(0, __position._M_node, __v);
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
else
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
return _M_insert_(__after._M_node, __after._M_node, __v);
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
}
|
|
|
|
else
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
return _M_insert_unique(__v).first;
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
}
|
|
|
|
else
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
// Equivalent keys.
|
|
|
|
return iterator(static_cast<_Link_type>
|
|
|
|
(const_cast<_Base_ptr>(__position._M_node)));
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
}
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
2002-03-07 07:53:23 +01:00
|
|
|
typename _Compare, typename _Alloc>
|
2004-10-03 17:50:32 +02:00
|
|
|
typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
|
|
|
|
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
_M_insert_equal_(const_iterator __position, const _Val& __v)
|
2002-03-07 07:53:23 +01:00
|
|
|
{
|
2005-06-27 18:35:49 +02:00
|
|
|
// end()
|
|
|
|
if (__position._M_node == _M_end())
|
2004-02-08 05:46:42 +01:00
|
|
|
{
|
2004-02-01 12:25:21 +01:00
|
|
|
if (size() > 0
|
2005-06-27 18:35:49 +02:00
|
|
|
&& !_M_impl._M_key_compare(_KeyOfValue()(__v),
|
2005-01-17 15:14:26 +01:00
|
|
|
_S_key(_M_rightmost())))
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
return _M_insert_(0, _M_rightmost(), __v);
|
2002-03-07 07:53:23 +01:00
|
|
|
else
|
2006-01-06 20:11:06 +01:00
|
|
|
return _M_insert_equal(__v);
|
2004-02-08 05:46:42 +01:00
|
|
|
}
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
else if (!_M_impl._M_key_compare(_S_key(__position._M_node),
|
|
|
|
_KeyOfValue()(__v)))
|
|
|
|
{
|
|
|
|
// First, try before...
|
|
|
|
const_iterator __before = __position;
|
|
|
|
if (__position._M_node == _M_leftmost()) // begin()
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
return _M_insert_(_M_leftmost(), _M_leftmost(), __v);
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
else if (!_M_impl._M_key_compare(_KeyOfValue()(__v),
|
|
|
|
_S_key((--__before)._M_node)))
|
|
|
|
{
|
|
|
|
if (_S_right(__before._M_node) == 0)
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
return _M_insert_(0, __before._M_node, __v);
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
else
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
return _M_insert_(__position._M_node,
|
|
|
|
__position._M_node, __v);
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
}
|
|
|
|
else
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
return _M_insert_equal(__v);
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// ... then try after.
|
|
|
|
const_iterator __after = __position;
|
|
|
|
if (__position._M_node == _M_rightmost())
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
return _M_insert_(0, _M_rightmost(), __v);
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
else if (!_M_impl._M_key_compare(_S_key((++__after)._M_node),
|
|
|
|
_KeyOfValue()(__v)))
|
|
|
|
{
|
|
|
|
if (_S_right(__position._M_node) == 0)
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
return _M_insert_(0, __position._M_node, __v);
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
else
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
return _M_insert_(__after._M_node, __after._M_node, __v);
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
}
|
|
|
|
else
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
return _M_insert_equal_lower(__v);
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KoV,
|
2002-03-07 07:53:23 +01:00
|
|
|
typename _Cmp, typename _Alloc>
|
|
|
|
template<class _II>
|
2004-02-08 05:46:42 +01:00
|
|
|
void
|
2004-10-03 17:50:32 +02:00
|
|
|
_Rb_tree<_Key, _Val, _KoV, _Cmp, _Alloc>::
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
_M_insert_unique(_II __first, _II __last)
|
2001-10-24 04:37:56 +02:00
|
|
|
{
|
2004-10-03 17:50:32 +02:00
|
|
|
for (; __first != __last; ++__first)
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
_M_insert_unique_(end(), *__first);
|
2001-10-24 04:37:56 +02:00
|
|
|
}
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KoV,
|
|
|
|
typename _Cmp, typename _Alloc>
|
2002-03-07 07:53:23 +01:00
|
|
|
template<class _II>
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
void
|
|
|
|
_Rb_tree<_Key, _Val, _KoV, _Cmp, _Alloc>::
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
_M_insert_equal(_II __first, _II __last)
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
{
|
|
|
|
for (; __first != __last; ++__first)
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
_M_insert_equal_(end(), *__first);
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
}
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
2002-03-07 07:53:23 +01:00
|
|
|
typename _Compare, typename _Alloc>
|
2004-02-08 05:46:42 +01:00
|
|
|
inline void
|
2004-10-03 17:50:32 +02:00
|
|
|
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
|
|
|
|
erase(iterator __position)
|
2002-03-07 07:53:23 +01:00
|
|
|
{
|
2004-10-03 17:50:32 +02:00
|
|
|
_Link_type __y =
|
|
|
|
static_cast<_Link_type>(_Rb_tree_rebalance_for_erase
|
|
|
|
(__position._M_node,
|
|
|
|
this->_M_impl._M_header));
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
_M_destroy_node(__y);
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
--_M_impl._M_node_count;
|
2002-03-07 07:53:23 +01:00
|
|
|
}
|
2000-10-05 13:27:02 +02:00
|
|
|
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
|
|
|
typename _Compare, typename _Alloc>
|
|
|
|
inline void
|
|
|
|
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
|
|
|
|
erase(const_iterator __position)
|
|
|
|
{
|
|
|
|
_Link_type __y =
|
|
|
|
static_cast<_Link_type>(_Rb_tree_rebalance_for_erase
|
|
|
|
(const_cast<_Base_ptr>(__position._M_node),
|
|
|
|
this->_M_impl._M_header));
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
_M_destroy_node(__y);
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
--_M_impl._M_node_count;
|
|
|
|
}
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
2002-03-07 07:53:23 +01:00
|
|
|
typename _Compare, typename _Alloc>
|
2004-10-03 17:50:32 +02:00
|
|
|
typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size_type
|
|
|
|
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
|
|
|
|
erase(const _Key& __x)
|
2002-03-07 07:53:23 +01:00
|
|
|
{
|
2006-10-07 10:20:35 +02:00
|
|
|
pair<iterator, iterator> __p = equal_range(__x);
|
|
|
|
const size_type __old_size = size();
|
2002-03-07 07:53:23 +01:00
|
|
|
erase(__p.first, __p.second);
|
2006-10-07 10:20:35 +02:00
|
|
|
return __old_size - size();
|
2000-10-05 13:27:02 +02:00
|
|
|
}
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
2002-03-07 07:53:23 +01:00
|
|
|
typename _Compare, typename _Alloc>
|
2004-02-08 05:46:42 +01:00
|
|
|
void
|
2004-10-03 17:50:32 +02:00
|
|
|
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
|
2002-03-07 07:53:23 +01:00
|
|
|
erase(iterator __first, iterator __last)
|
|
|
|
{
|
|
|
|
if (__first == begin() && __last == end())
|
|
|
|
clear();
|
|
|
|
else
|
2004-10-13 02:11:14 +02:00
|
|
|
while (__first != __last)
|
|
|
|
erase(__first++);
|
2000-10-05 13:27:02 +02:00
|
|
|
}
|
2002-03-07 07:53:23 +01:00
|
|
|
|
re PR libstdc++/24975 (Aliasing problems inside libstdc++)
2005-11-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24975
* include/bits/stl_set.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Don't break aliasing
rules casting to _Rep_iterator&, forward to _Rb_tree facilities.
* include/bits/stl_multiset.h (insert(iterator, const value_type&),
erase(iterator), erase(iterator, iterator)): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert(_Const_Base_ptr,
_Const_Base_ptr, const value_type&), insert_unique(const_iterator,
const value_type&), insert_equal(const_iterator, const value_type&),
erase(const_iterator), erase(const_iterator, const_iterator)): New,
_Rb_tree<>::const_iterator counterparts of existing facilities.
From-SVN: r107362
2005-11-22 15:53:03 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
|
|
|
typename _Compare, typename _Alloc>
|
|
|
|
void
|
|
|
|
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
|
|
|
|
erase(const_iterator __first, const_iterator __last)
|
|
|
|
{
|
|
|
|
if (__first == begin() && __last == end())
|
|
|
|
clear();
|
|
|
|
else
|
|
|
|
while (__first != __last)
|
|
|
|
erase(__first++);
|
|
|
|
}
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
2002-03-07 07:53:23 +01:00
|
|
|
typename _Compare, typename _Alloc>
|
2004-02-08 05:46:42 +01:00
|
|
|
void
|
2004-10-03 17:50:32 +02:00
|
|
|
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
|
2004-02-08 05:46:42 +01:00
|
|
|
erase(const _Key* __first, const _Key* __last)
|
|
|
|
{
|
|
|
|
while (__first != __last)
|
|
|
|
erase(*__first++);
|
2000-10-05 13:27:02 +02:00
|
|
|
}
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
2002-03-07 07:53:23 +01:00
|
|
|
typename _Compare, typename _Alloc>
|
re PR libstdc++/31440 (libstdc++-g++-v3 discarded qualifiers)
2007-04-03 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/31440
* include/bits/stl_tree.h (_M_lower_bound(_Link_type, _Link_type,
const _Key&), _M_upper_bound(_Link_type, _Link_type, const _Key&)):
Add.
(_M_equal_range(const _Key&) const): Remove.
(lower_bound(const key_type&), lower_bound(const key_type&) const,
upper_bound(const key_type&), upper_bound(const key_type&) const,
equal_range(const key_type&), equal_range(const key_type&) const):
Adjust.
(find(const _Key&), find(const _Key&) const): Tweak.
* testsuite/23_containers/map/operations/31440.cc: New.
From-SVN: r123452
2007-04-03 10:32:31 +02:00
|
|
|
typename _Rb_tree<_Key, _Val, _KeyOfValue,
|
|
|
|
_Compare, _Alloc>::iterator
|
2004-10-03 17:50:32 +02:00
|
|
|
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
|
|
|
|
find(const _Key& __k)
|
2002-03-07 07:53:23 +01:00
|
|
|
{
|
re PR libstdc++/31440 (libstdc++-g++-v3 discarded qualifiers)
2007-04-03 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/31440
* include/bits/stl_tree.h (_M_lower_bound(_Link_type, _Link_type,
const _Key&), _M_upper_bound(_Link_type, _Link_type, const _Key&)):
Add.
(_M_equal_range(const _Key&) const): Remove.
(lower_bound(const key_type&), lower_bound(const key_type&) const,
upper_bound(const key_type&), upper_bound(const key_type&) const,
equal_range(const key_type&), equal_range(const key_type&) const):
Adjust.
(find(const _Key&), find(const _Key&) const): Tweak.
* testsuite/23_containers/map/operations/31440.cc: New.
From-SVN: r123452
2007-04-03 10:32:31 +02:00
|
|
|
iterator __j = _M_lower_bound(_M_begin(), _M_end(), __k);
|
2004-10-03 17:50:32 +02:00
|
|
|
return (__j == end()
|
|
|
|
|| _M_impl._M_key_compare(__k,
|
|
|
|
_S_key(__j._M_node))) ? end() : __j;
|
2002-03-07 07:53:23 +01:00
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
2002-03-07 07:53:23 +01:00
|
|
|
typename _Compare, typename _Alloc>
|
re PR libstdc++/31440 (libstdc++-g++-v3 discarded qualifiers)
2007-04-03 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/31440
* include/bits/stl_tree.h (_M_lower_bound(_Link_type, _Link_type,
const _Key&), _M_upper_bound(_Link_type, _Link_type, const _Key&)):
Add.
(_M_equal_range(const _Key&) const): Remove.
(lower_bound(const key_type&), lower_bound(const key_type&) const,
upper_bound(const key_type&), upper_bound(const key_type&) const,
equal_range(const key_type&), equal_range(const key_type&) const):
Adjust.
(find(const _Key&), find(const _Key&) const): Tweak.
* testsuite/23_containers/map/operations/31440.cc: New.
From-SVN: r123452
2007-04-03 10:32:31 +02:00
|
|
|
typename _Rb_tree<_Key, _Val, _KeyOfValue,
|
|
|
|
_Compare, _Alloc>::const_iterator
|
2004-10-03 17:50:32 +02:00
|
|
|
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
|
2002-03-07 07:53:23 +01:00
|
|
|
find(const _Key& __k) const
|
|
|
|
{
|
re PR libstdc++/31440 (libstdc++-g++-v3 discarded qualifiers)
2007-04-03 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/31440
* include/bits/stl_tree.h (_M_lower_bound(_Link_type, _Link_type,
const _Key&), _M_upper_bound(_Link_type, _Link_type, const _Key&)):
Add.
(_M_equal_range(const _Key&) const): Remove.
(lower_bound(const key_type&), lower_bound(const key_type&) const,
upper_bound(const key_type&), upper_bound(const key_type&) const,
equal_range(const key_type&), equal_range(const key_type&) const):
Adjust.
(find(const _Key&), find(const _Key&) const): Tweak.
* testsuite/23_containers/map/operations/31440.cc: New.
From-SVN: r123452
2007-04-03 10:32:31 +02:00
|
|
|
const_iterator __j = _M_lower_bound(_M_begin(), _M_end(), __k);
|
[multiple changes]
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::destroy_node): Uglify.
(_M_erase, erase(iterator), erase(const_iterator)): Adjust
2006-11-25 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree<>::_M_lower_bound(_Const_Link_type,
_Const_Link_type, const _Key&), _M_upper_bound(_Const_Link_type,
_Const_Link_type, const _Key&)): Add.
(lower_bound(const key_type&), upper_bound(const key_type&),
find(const key_type&)): Call the latter.
2006-11-25 Gawain Bolton <gp.bolton@computer.org>
PR libstdc++/29385 (partial)
* include/bits/stl_tree.h (_Rb_tree_rotate_left,
_Rb_tree_rotate_right): Do not declare.
(_Rb_tree<>::_M_insert(_Base_ptr, _Base_ptr, const value_type&),
_M_insert(_Const_Base_ptr, _Const_Base_ptr, const value_type&),
_M_insert_unique(iterator, const value_type&),
_M_insert_unique(const_iterator, const value_type&),
_M_insert_equal(iterator, const value_type&),
_M_insert_equal(const_iterator, const value_type&)):
Remove.
(_Rb_tree<>::_M_insert_(_Const_Base_ptr, _Const_Base_ptr,
const value_type&), _M_insert_unique_(const_iterator,
const value_type&), _M_insert_equal_(const_iterator,
const value_type&)): Add, adjust all callers.
* include/bits/stl_map.h (map<>::insert(iterator, const value_type&)):
Adjust.
* include/bits/stl_set.h (set<>::insert(iterator, const value_type&)):
Likewise.
* include/bits/stl_multimap.h (multimap<>::insert(iterator,
const value_type&)): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert(iterator,
const value_type&)): Likewise.
From-SVN: r119190
2006-11-25 11:35:52 +01:00
|
|
|
return (__j == end()
|
|
|
|
|| _M_impl._M_key_compare(__k,
|
|
|
|
_S_key(__j._M_node))) ? end() : __j;
|
2000-10-05 13:27:02 +02:00
|
|
|
}
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
2002-03-07 07:53:23 +01:00
|
|
|
typename _Compare, typename _Alloc>
|
2004-10-03 17:50:32 +02:00
|
|
|
typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size_type
|
|
|
|
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
|
2002-03-07 07:53:23 +01:00
|
|
|
count(const _Key& __k) const
|
2001-10-24 04:37:56 +02:00
|
|
|
{
|
2002-03-07 07:53:23 +01:00
|
|
|
pair<const_iterator, const_iterator> __p = equal_range(__k);
|
2004-02-01 12:25:21 +01:00
|
|
|
const size_type __n = std::distance(__p.first, __p.second);
|
2002-03-07 07:53:23 +01:00
|
|
|
return __n;
|
2001-10-24 04:37:56 +02:00
|
|
|
}
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2003-07-30 17:01:58 +02:00
|
|
|
unsigned int
|
|
|
|
_Rb_tree_black_count(const _Rb_tree_node_base* __node,
|
|
|
|
const _Rb_tree_node_base* __root);
|
2002-03-07 07:53:23 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
template<typename _Key, typename _Val, typename _KeyOfValue,
|
2002-03-07 07:53:23 +01:00
|
|
|
typename _Compare, typename _Alloc>
|
2004-02-08 05:46:42 +01:00
|
|
|
bool
|
2002-03-07 07:53:23 +01:00
|
|
|
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::__rb_verify() const
|
|
|
|
{
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
if (_M_impl._M_node_count == 0 || begin() == end())
|
|
|
|
return _M_impl._M_node_count == 0 && begin() == end()
|
|
|
|
&& this->_M_impl._M_header._M_left == _M_end()
|
|
|
|
&& this->_M_impl._M_header._M_right == _M_end();
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2004-02-02 00:19:55 +01:00
|
|
|
unsigned int __len = _Rb_tree_black_count(_M_leftmost(), _M_root());
|
2004-02-08 05:46:42 +01:00
|
|
|
for (const_iterator __it = begin(); __it != end(); ++__it)
|
2004-02-02 00:19:55 +01:00
|
|
|
{
|
|
|
|
_Const_Link_type __x = static_cast<_Const_Link_type>(__it._M_node);
|
|
|
|
_Const_Link_type __L = _S_left(__x);
|
|
|
|
_Const_Link_type __R = _S_right(__x);
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2004-02-02 00:19:55 +01:00
|
|
|
if (__x->_M_color == _S_red)
|
2004-02-08 05:46:42 +01:00
|
|
|
if ((__L && __L->_M_color == _S_red)
|
2004-02-02 00:19:55 +01:00
|
|
|
|| (__R && __R->_M_color == _S_red))
|
|
|
|
return false;
|
2004-02-08 05:46:42 +01:00
|
|
|
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
if (__L && _M_impl._M_key_compare(_S_key(__x), _S_key(__L)))
|
2004-02-02 00:19:55 +01:00
|
|
|
return false;
|
[multiple changes]
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
default argument in constructors.
(_Rb_tree::_M_empty_initialize): Remove.
2004-03-25 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/map/operators/1_neg.cc: Adjust line numbers.
* testsuite/23_containers/set/operators/1_neg.cc: Same.
2004-03-25 Dhruv Matani <dhruvbird@gmx.net>
* include/bits/cpp_type_traits.h: Changed __is_pod
completely. Now, it does not use any of the previous type_traits
to detect the pod types, and it also detects function pointers as
POD types.
* include/bits/stl_tree.h: Introduced a new class _Rb_tree_impl,
which encapsulates the internal implementation of an rb_tree. Made
the allocator a base class of this class instead of the rb_tree,
which was not conforming. This _Rb_tree_impl class is also
specialized on whether the _Compare parameter is a POD type or
not. If so, then it maintains the comparison function as a data
member, otherwise it makes the _Compare parameter a base class of
itself. Also, _M_key_compare is now a function instead of a data
member, so that the above trick can work properly. Delegated the
initialization of the other data members to this newly created
class. Also, now other member functions of rb_tree must refer to
_M_key_compare as _M_impl._M_key_compare(). The other data members
(*) can be referenced to as _M_impl.(*), where
(*) includes _M_header, and _M_node_count.
From-SVN: r79977
2004-03-26 01:38:57 +01:00
|
|
|
if (__R && _M_impl._M_key_compare(_S_key(__R), _S_key(__x)))
|
2004-02-02 00:19:55 +01:00
|
|
|
return false;
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2004-02-02 00:19:55 +01:00
|
|
|
if (!__L && !__R && _Rb_tree_black_count(__x, _M_root()) != __len)
|
|
|
|
return false;
|
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2004-02-02 00:19:55 +01:00
|
|
|
if (_M_leftmost() != _Rb_tree_node_base::_S_minimum(_M_root()))
|
|
|
|
return false;
|
|
|
|
if (_M_rightmost() != _Rb_tree_node_base::_S_maximum(_M_root()))
|
|
|
|
return false;
|
|
|
|
return true;
|
2002-03-07 07:53:23 +01:00
|
|
|
}
|
2005-12-19 01:56:05 +01:00
|
|
|
|
|
|
|
_GLIBCXX_END_NAMESPACE
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
#endif
|