19720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block/*
29720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block *
39720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Copyright (c) 1994
49720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Hewlett-Packard Company
59720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block *
69720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Copyright (c) 1996,1997
79720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Silicon Graphics Computer Systems, Inc.
89720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block *
99720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Copyright (c) 1997
109720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Moscow Center for SPARC Technology
119720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block *
129720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Copyright (c) 1999
139720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Boris Fomitchev
149720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block *
159720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * This material is provided "as is", with absolutely no warranty expressed
169720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * or implied. Any use is at your own risk.
179720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block *
189720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Permission to use or copy this software for any purpose is hereby granted
199720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * without fee, provided the above notices are retained on all copies.
209720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Permission to modify the code and to distribute modified code is granted,
219720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * provided the above notices are retained, and a notice that the code was
229720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * modified is included with the above copyright notice.
239720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block *
249720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block */
259720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
269720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block/* NOTE: This is an internal header file, included by other STL headers.
279720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block *   You should not attempt to use it directly.
289720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block */
299720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
309720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#ifndef _STLP_INTERNAL_DBG_TREE_H
319720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#define _STLP_INTERNAL_DBG_TREE_H
329720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
339720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#ifndef _STLP_DBG_ITERATOR_H
349720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#  include <stl/debug/_iterator.h>
359720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
369720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
379720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
389720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#  include <stl/_function_base.h>
399720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
409720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
419720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#ifndef _STLP_INTERNAL_ALLOC_H
429720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#  include <stl/_alloc.h>
439720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
449720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
459720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block_STLP_BEGIN_NAMESPACE
469720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
479720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block_STLP_MOVE_TO_PRIV_NAMESPACE
489720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
499720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blocktemplate <class _Key, class _Compare>
509720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockclass _DbgCompare {
519720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockpublic:
529720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _DbgCompare() {}
539720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _DbgCompare(const _Compare& __cmp) : _M_non_dbg_cmp(__cmp) {}
549720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _DbgCompare(const _DbgCompare& __cmp) : _M_non_dbg_cmp(__cmp._M_non_dbg_cmp) {}
559720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
569720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if !defined (_STLP_USE_CONTAINERS_EXTENSION)
579720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  bool operator () (const _Key& __lhs, const _Key& __rhs) const {
589720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#else
599720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  template <class _Kp1, class _Kp2>
609720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  bool operator () (const _Kp1& __lhs, const _Kp2& __rhs) const {
619720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
629720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    if (_M_non_dbg_cmp(__lhs, __rhs)) {
639720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      return true;
649720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    }
659720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    return false;
669720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
679720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
689720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _Compare non_dbg_key_comp() const { return _M_non_dbg_cmp; }
699720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockprivate:
709720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _Compare _M_non_dbg_cmp;
719720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block};
729720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
739720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#define _STLP_NON_DBG_TREE _STLP_PRIV _STLP_NON_DBG_NAME(Rb_tree) <_Key, _STLP_PRIV _DbgCompare<_Key, _Compare>, _Value, _KeyOfValue, _Traits, _Alloc>
749720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
759720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
769720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block_STLP_MOVE_TO_STD_NAMESPACE
779720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blocktemplate <class _Key, class _Compare,
789720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block          class _Value, class _KeyOfValue, class _Traits, class _Alloc >
799720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockinline _Value*
809720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockvalue_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_TREE >&)
819720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block{ return (_Value*)0; }
829720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blocktemplate <class _Key, class _Compare,
839720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block          class _Value, class _KeyOfValue, class _Traits, class _Alloc >
849720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockinline bidirectional_iterator_tag
859720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockiterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_TREE >&)
869720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block{ return bidirectional_iterator_tag(); }
879720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block_STLP_MOVE_TO_PRIV_NAMESPACE
889720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
899720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
909720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blocktemplate <class _Key, class _Compare,
919720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block          class _Value, class _KeyOfValue, class _Traits,
92e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott          _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Value>) >
939720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockclass _Rb_tree {
949720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef _STLP_NON_DBG_TREE _Base;
959720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef _Rb_tree<_Key, _Compare, _Value, _KeyOfValue, _Traits, _Alloc> _Self;
969720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _Base _M_non_dbg_impl;
979720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_PRIV __owned_list _M_iter_list;
989720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
999720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockpublic:
1009720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  __IMPORT_CONTAINER_TYPEDEFS(_Base)
1019720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Base::key_type key_type;
1029720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1039720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Traits::_NonConstTraits _NonConstIteTraits;
1049720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Traits::_ConstTraits    _ConstIteTraits;
1059720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_NonConstIteTraits> > iterator;
1069720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_ConstIteTraits> >    const_iterator;
1079720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1089720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS;
1099720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1109720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockprivate:
1119720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
1129720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void _Invalidate_iterator(const iterator& __it)
1139720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { _STLP_PRIV __invalidate_iterator(&_M_iter_list,__it); }
1149720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void _Invalidate_iterators(const iterator& __first, const iterator& __last)
1159720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); }
1169720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1179720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Base::iterator _Base_iterator;
1189720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Base::const_iterator _Base_const_iterator;
1199720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1209720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockpublic:
1219720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _Rb_tree()
1229720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    : _M_non_dbg_impl(), _M_iter_list(&_M_non_dbg_impl) {}
1239720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _Rb_tree(const _Compare& __comp)
1249720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    : _M_non_dbg_impl(__comp), _M_iter_list(&_M_non_dbg_impl) {}
1259720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _Rb_tree(const _Compare& __comp, const allocator_type& __a)
1269720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    : _M_non_dbg_impl(__comp, __a), _M_iter_list(&_M_non_dbg_impl) {}
1279720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _Rb_tree(const _Self& __x)
1289720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    : _M_non_dbg_impl(__x._M_non_dbg_impl), _M_iter_list(&_M_non_dbg_impl) {}
1299720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
130e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#if !defined (_STLP_NO_MOVE_SEMANTIC)
1319720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _Rb_tree(__move_source<_Self> src):
1329720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)),
1339720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_iter_list(&_M_non_dbg_impl) {
134e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#  if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
1359720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    src.get()._M_iter_list._Invalidate_all();
136e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#  else
1379720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    src.get()._M_iter_list._Set_owner(_M_iter_list);
138e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#  endif
1399720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
140e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#endif
1419720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1429720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  ~_Rb_tree() {}
1439720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1449720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _Self& operator=(const _Self& __x) {
1459720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    if (this != &__x) {
1469720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      //Should not invalidate end iterator:
1479720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      _Invalidate_iterators(begin(), end());
1489720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      _M_non_dbg_impl = __x._M_non_dbg_impl;
1499720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    }
1509720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    return *this;
1519720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
1529720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1539720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
1549720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _Compare key_comp() const { return _M_non_dbg_impl.key_comp().non_dbg_key_comp(); }
1559720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1569720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
1579720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); }
1589720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
1599720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); }
1609720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1619720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  reverse_iterator rbegin() { return reverse_iterator(end()); }
1629720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
1639720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  reverse_iterator rend() { return reverse_iterator(begin()); }
1649720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
1659720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1669720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  bool empty() const { return _M_non_dbg_impl.empty(); }
1679720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  size_type size() const { return _M_non_dbg_impl.size(); }
1689720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  size_type max_size() const { return _M_non_dbg_impl.max_size(); }
1699720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_TEMPLATE_FOR_CONT_EXT
1709720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  size_type count(const _KT& __x) const { return _M_non_dbg_impl.count(__x); }
1719720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1729720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void swap(_Self& __t) {
1739720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl.swap(__t._M_non_dbg_impl);
1749720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_iter_list._Swap_owners(__t._M_iter_list);
1759720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
1769720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1779720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_TEMPLATE_FOR_CONT_EXT
1789720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  iterator find(const _KT& __k)
1799720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { return iterator(&_M_iter_list, _M_non_dbg_impl.find(__k)); }
1809720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_TEMPLATE_FOR_CONT_EXT
1819720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  const_iterator find(const _KT& __k) const
1829720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { return const_iterator(&_M_iter_list, _M_non_dbg_impl.find(__k)); }
1839720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1849720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_TEMPLATE_FOR_CONT_EXT
1859720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  iterator lower_bound(const _KT& __x)
1869720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { return iterator(&_M_iter_list, _M_non_dbg_impl.lower_bound(__x)); }
1879720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_TEMPLATE_FOR_CONT_EXT
1889720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  const_iterator lower_bound(const _KT& __x) const
1899720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { return const_iterator(&_M_iter_list, _M_non_dbg_impl.lower_bound(__x)); }
1909720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1919720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_TEMPLATE_FOR_CONT_EXT
1929720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  iterator upper_bound(const _KT& __x)
1939720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { return iterator(&_M_iter_list, _M_non_dbg_impl.upper_bound(__x)); }
1949720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_TEMPLATE_FOR_CONT_EXT
1959720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  const_iterator upper_bound(const _KT& __x) const
1969720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { return const_iterator(&_M_iter_list, _M_non_dbg_impl.upper_bound(__x)); }
1979720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1989720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_TEMPLATE_FOR_CONT_EXT
1999720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  pair<iterator,iterator> equal_range(const _KT& __x) {
2009720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    return pair<iterator, iterator>(iterator(&_M_iter_list, _M_non_dbg_impl.lower_bound(__x)),
2019720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                                    iterator(&_M_iter_list, _M_non_dbg_impl.upper_bound(__x)));
2029720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
2039720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_TEMPLATE_FOR_CONT_EXT
2049720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  pair<const_iterator, const_iterator> equal_range(const _KT& __x) const {
2059720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    return pair<const_iterator,const_iterator>(const_iterator(&_M_iter_list, _M_non_dbg_impl.lower_bound(__x)),
2069720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                                               const_iterator(&_M_iter_list, _M_non_dbg_impl.upper_bound(__x)));
2079720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
2089720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2099720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_TEMPLATE_FOR_CONT_EXT
2109720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  pair<iterator,iterator> equal_range_unique(const _KT& __x) {
2119720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_STD::pair<_Base_iterator, _Base_iterator> __p;
2129720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    __p = _M_non_dbg_impl.equal_range_unique(__x);
2139720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    return pair<iterator, iterator>(iterator(&_M_iter_list, __p.first), iterator(&_M_iter_list, __p.second));
2149720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
2159720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_TEMPLATE_FOR_CONT_EXT
2169720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  pair<const_iterator, const_iterator> equal_range_unique(const _KT& __x) const {
2179720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_STD::pair<_Base_const_iterator, _Base_const_iterator> __p;
2189720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    __p = _M_non_dbg_impl.equal_range_unique(__x);
2199720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    return pair<const_iterator, const_iterator>(const_iterator(&_M_iter_list, __p.first),
2209720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                                                const_iterator(&_M_iter_list, __p.second));
2219720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
2229720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2239720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  pair<iterator,bool> insert_unique(const value_type& __x) {
2249720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_STD::pair<_Base_iterator, bool> __res = _M_non_dbg_impl.insert_unique(__x);
2259720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    return pair<iterator, bool>(iterator(&_M_iter_list, __res.first), __res.second);
2269720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
2279720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  iterator insert_equal(const value_type& __x)
2289720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { return iterator(&_M_iter_list, _M_non_dbg_impl.insert_equal(__x)); }
2299720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2309720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  iterator insert_unique(iterator __pos, const value_type& __x) {
2319720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list,__pos))
2329720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    return iterator(&_M_iter_list, _M_non_dbg_impl.insert_unique(__pos._M_iterator, __x));
2339720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
2349720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  iterator insert_equal(iterator __pos, const value_type& __x) {
2359720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list, __pos))
2369720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    return iterator(&_M_iter_list, _M_non_dbg_impl.insert_equal(__pos._M_iterator, __x));
2379720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
2389720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2399720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if defined (_STLP_MEMBER_TEMPLATES)
2409720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  template<class _InputIterator>
2419720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void insert_equal(_InputIterator __first, _InputIterator __last) {
2429720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(__check_range(__first,__last))
2439720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl.insert_equal(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
2449720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
2459720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  template<class _InputIterator>
2469720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void insert_unique(_InputIterator __first, _InputIterator __last) {
2479720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(__check_range(__first,__last))
2489720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl.insert_unique(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last));
2499720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
2509720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#else
2519720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void insert_unique(const_iterator __first, const_iterator __last) {
2529720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(__check_range(__first,__last))
2539720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl.insert_unique(__first._M_iterator, __last._M_iterator);
2549720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
2559720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void insert_unique(const value_type* __first, const value_type* __last) {
2569720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(__check_ptr_range(__first,__last))
2579720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl.insert_unique(__first, __last);
2589720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
2599720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void insert_equal(const_iterator __first, const_iterator __last) {
2609720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(__check_range(__first,__last))
2619720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl.insert_equal(__first._M_iterator, __last._M_iterator);
2629720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
2639720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void insert_equal(const value_type* __first, const value_type* __last) {
2649720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(__check_ptr_range(__first,__last))
2659720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl.insert_equal(__first, __last);
2669720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
2679720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
2689720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2699720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void erase(iterator __pos) {
2709720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list,__pos))
2719720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(_Dereferenceable(__pos))
2729720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _Invalidate_iterator(__pos);
2739720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl.erase(__pos._M_iterator);
2749720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
2759720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  size_type erase(const key_type& __x) {
276e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott    pair<iterator, iterator> __p = equal_range(__x);
277e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott    size_type __n = _STLP_STD::distance(__p.first._M_iterator, __p.second._M_iterator);
278e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott    _Invalidate_iterators(__p.first, __p.second);
279e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott    _M_non_dbg_impl.erase(__p.first._M_iterator, __p.second._M_iterator);
2809720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    return __n;
2819720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
2829720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  size_type erase_unique(const key_type& __x) {
2839720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _Base_iterator __i = _M_non_dbg_impl.find(__x);
2849720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    if (__i != _M_non_dbg_impl.end()) {
2859720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      _Invalidate_iterator(iterator(&_M_iter_list, __i));
2869720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      _M_non_dbg_impl.erase(__i);
2879720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      return 1;
2889720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    }
2899720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    return 0;
2909720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
2919720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2929720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void erase(iterator __first, iterator __last) {
2939720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _STLP_DEBUG_CHECK(__check_range(__first, __last, begin(), end()))
2949720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _Invalidate_iterators(__first, __last);
2959720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator);
2969720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
2979720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void erase(const key_type* __first, const key_type* __last) {
2989720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    while (__first != __last) erase(*__first++);
2999720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
3009720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3019720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void clear() {
3029720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    //should not invalidate end:
3039720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _Invalidate_iterators(begin(), end());
3049720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    _M_non_dbg_impl.clear();
3059720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
3069720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block};
3079720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3089720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block_STLP_MOVE_TO_STD_NAMESPACE
3099720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block_STLP_END_NAMESPACE
3109720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3119720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#undef _STLP_NON_DBG_TREE
3129720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3139720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif /* _STLP_INTERNAL_DBG_TREE_H */
3149720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3159720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// Local Variables:
3169720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// mode:C++
3179720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// End:
318