STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Protected Member Functions | List of all members
_Tree< _Traits > Class Template Reference
Inheritance diagram for _Tree< _Traits >:
_Tree_comp< !is_empty< _Traits::key_compare >::value, _Traits > _Tree_buy< _Traits::value_type, _Traits::allocator_type > _Tree_alloc<!is_empty< _Traits::allocator_type >::value, _Tree_base_types< _Traits::value_type, _Traits::allocator_type > > _Tree_val< _Tree_base_types< _Traits::value_type, _Traits::allocator_type >::_Val_types > _Container_base0

Public Types

enum  { _Multi = _Traits::_Multi }
 
typedef _Tree< _Traits > _Myt
 
typedef _Tree_comp< !is_empty< typename _Traits::key_compare >::value, _Traits > _Mybase
 
typedef _Traits::key_type key_type
 
typedef _Traits::value_compare value_compare
 
typedef _Mybase::_Node _Node
 
typedef _Mybase::_Nodeptr _Nodeptr
 
typedef _Mybase::_Alty _Alty
 
typedef _Mybase::key_compare key_compare
 
typedef _Mybase::allocator_type allocator_type
 
typedef _Mybase::value_type value_type
 
typedef _Mybase::size_type size_type
 
typedef _Mybase::difference_type difference_type
 
typedef _Mybase::pointer pointer
 
typedef _Mybase::const_pointer const_pointer
 
typedef _Mybase::reference reference
 
typedef _Mybase::const_reference const_reference
 
typedef _Mybase::const_iterator const_iterator
 
typedef _If< is_same< key_type, value_type >::value, typename _Mybase::const_iterator, typename _Mybase::iterator >::type iterator
 
typedef _STD reverse_iterator< iteratorreverse_iterator
 
typedef _STD reverse_iterator< const_iteratorconst_reverse_iterator
 
typedef pair< iterator, bool_Pairib
 
typedef pair< iterator, iterator_Pairii
 
typedef pair< const_iterator, const_iterator_Paircc
 
- Public Types inherited from _Tree_comp< !is_empty< _Traits::key_compare >::value, _Traits >
typedef _Tree_comp< _Pr_has_storage, _Traits > _Myt
 
typedef _Tree_buy< typename _Traits::value_type, typename _Traits::allocator_type > _Mybase
 
typedef _Traits::allocator_type allocator_type
 
typedef _Traits::key_compare key_compare
 
- Public Types inherited from _Tree_buy< _Traits::value_type, _Traits::allocator_type >
typedef _Tree_alloc<!is_empty< _Traits::allocator_type >::value, _Tree_base_types< _Traits::value_type, _Traits::allocator_type > > _Mybase
 
typedef _Mybase::_Alty _Alty
 
typedef _Mybase::_Nodeptr _Nodeptr
 
typedef _Mybase::value_type value_type
 
- Public Types inherited from _Tree_alloc<!is_empty< _Traits::allocator_type >::value, _Tree_base_types< _Traits::value_type, _Traits::allocator_type > >
typedef _Tree_alloc< _Al_has_storage, _Tree_base_types< _Traits::value_type, _Traits::allocator_type > > _Myt
 
typedef _Tree_base_types< _Traits::value_type, _Traits::allocator_type >::_Alloc _Alloc
 
typedef _Tree_base_types< _Traits::value_type, _Traits::allocator_type >::_Alnod_type _Alty
 
typedef _Tree_base_types< _Traits::value_type, _Traits::allocator_type >::_Node _Node
 
typedef _Tree_base_types< _Traits::value_type, _Traits::allocator_type >::_Nodeptr _Nodeptr
 
- Public Types inherited from _Tree_val< _Tree_base_types< _Traits::value_type, _Traits::allocator_type >::_Val_types >
enum  _Redbl
 
typedef _Tree_val< _Tree_base_types< _Traits::value_type, _Traits::allocator_type >::_Val_types > _Myt
 
typedef _Tree_base_types< _Traits::value_type, _Traits::allocator_type >::_Val_types::_Nodeptr _Nodeptr
 
typedef _Nodeptr_Nodepref
 
typedef _Tree_base_types< _Traits::value_type, _Traits::allocator_type >::_Val_types::value_type value_type
 
typedef _Tree_base_types< _Traits::value_type, _Traits::allocator_type >::_Val_types::size_type size_type
 
typedef _Tree_base_types< _Traits::value_type, _Traits::allocator_type >::_Val_types::difference_type difference_type
 
typedef _Tree_base_types< _Traits::value_type, _Traits::allocator_type >::_Val_types::pointer pointer
 
typedef _Tree_base_types< _Traits::value_type, _Traits::allocator_type >::_Val_types::const_pointer const_pointer
 
typedef _Tree_base_types< _Traits::value_type, _Traits::allocator_type >::_Val_types::reference reference
 
typedef _Tree_base_types< _Traits::value_type, _Traits::allocator_type >::_Val_types::const_reference const_reference
 
typedef _Tree_const_iterator< _Mytconst_iterator
 
typedef _Tree_iterator< _Mytiterator
 

Public Member Functions

 _Tree (const key_compare &_Parg, const allocator_type &_Al)
 
 _Tree (const value_type *_First, const value_type *_Last, const key_compare &_Parg, const allocator_type &_Al)
 
 _Tree (const _Myt &_Right, const allocator_type &_Al)
 
 _Tree (_Myt &&_Right)
 
 _Tree (_Myt &&_Right, const allocator_type &_Al)
 
_Mytoperator= (_Myt &&_Right)
 
void _Assign_rv (_Myt &&_Right, true_type)
 
void _Assign_rv (_Myt &&_Right, false_type)
 
void _Assign_rv (_Myt &&_Right)
 
_Pairib insert (value_type &&_Val)
 
iterator insert (const_iterator _Where, value_type &&_Val)
 
template<class _Valty >
enable_if< is_convertible< _Valty, value_type >::value, _Pairib >::type insert (_Valty &&_Val)
 
template<class _Valty >
enable_if< is_convertible< _Valty, value_type >::value, iterator >::type insert (const_iterator _Where, _Valty &&_Val)
 
template<class... _Valty>
_Pairib emplace (_Valty &&..._Val)
 
template<class... _Valty>
iterator emplace_hint (const_iterator _Where, _Valty &&..._Val)
 
 ~_Tree () _NOEXCEPT
 
_Mytoperator= (const _Myt &_Right)
 
iterator begin () _NOEXCEPT
 
const_iterator begin () const _NOEXCEPT
 
iterator end () _NOEXCEPT
 
const_iterator end () const _NOEXCEPT
 
reverse_iterator rbegin () _NOEXCEPT
 
const_reverse_iterator rbegin () const _NOEXCEPT
 
reverse_iterator rend () _NOEXCEPT
 
const_reverse_iterator rend () const _NOEXCEPT
 
const_iterator cbegin () const _NOEXCEPT
 
const_iterator cend () const _NOEXCEPT
 
const_reverse_iterator crbegin () const _NOEXCEPT
 
const_reverse_iterator crend () const _NOEXCEPT
 
size_type size () const _NOEXCEPT
 
size_type max_size () const _NOEXCEPT
 
bool empty () const _NOEXCEPT
 
allocator_type get_allocator () const _NOEXCEPT
 
key_compare key_comp () const
 
value_compare value_comp () const
 
_Pairib insert (const value_type &_Val)
 
iterator insert (const_iterator _Where, const value_type &_Val)
 
template<class _Iter >
void insert (_Iter _First, _Iter _Last)
 
void insert (_XSTD initializer_list< value_type > _Ilist)
 
iterator erase (const_iterator _Where)
 
iterator erase (const_iterator _First, const_iterator _Last)
 
size_type erase (const key_type &_Keyval)
 
void clear () _NOEXCEPT
 
iterator find (const key_type &_Keyval)
 
const_iterator find (const key_type &_Keyval) const
 
size_type count (const key_type &_Keyval) const
 
iterator lower_bound (const key_type &_Keyval)
 
const_iterator lower_bound (const key_type &_Keyval) const
 
iterator upper_bound (const key_type &_Keyval)
 
const_iterator upper_bound (const key_type &_Keyval) const
 
_Pairii equal_range (const key_type &_Keyval)
 
_Paircc equal_range (const key_type &_Keyval) const
 
void swap (_Myt &_Right)
 
- Public Member Functions inherited from _Tree_comp< !is_empty< _Traits::key_compare >::value, _Traits >
 _Tree_comp (const key_compare &_Parg, const allocator_type &_Al)
 
key_compare_Getcomp ()
 
const key_compare_Getcomp () const
 
void _Setcomp (const key_compare &_Right)
 
void _Swapcomp (key_compare &_Right)
 
- Public Member Functions inherited from _Tree_buy< _Traits::value_type, _Traits::allocator_type >
 _Tree_buy (const _Traits::allocator_type &_Al=_Traits::allocator_type())
 
_Nodeptr _Buynode0 ()
 
void _Freenode0 (_Nodeptr _Pnode)
 
_Nodeptr _Buynode (_Valty &&..._Val)
 
- Public Member Functions inherited from _Tree_alloc<!is_empty< _Traits::allocator_type >::value, _Tree_base_types< _Traits::value_type, _Traits::allocator_type > >
 _Tree_alloc (const _Alloc &_Al=_Alloc())
 
 ~_Tree_alloc () _NOEXCEPT
 
void _Change_alloc (const _Alty &_Al)
 
void _Swap_alloc (_Myt &_Right)
 
_Nodeptr _Buyheadnode ()
 
void _Freeheadnode (_Nodeptr _Pnode)
 
_Alty_Getal ()
 
const _Alty_Getal () const
 
- Public Member Functions inherited from _Tree_val< _Tree_base_types< _Traits::value_type, _Traits::allocator_type >::_Val_types >
 _Tree_val ()
 
- Public Member Functions inherited from _Container_base0
void _Orphan_all ()
 
void _Swap_all (_Container_base0 &)
 

Protected Member Functions

template<class _Valty >
_Nodeptr _Buynode_if_nil (_Nodeptr _Node, _Valty &&)
 
template<class _Valty >
_Nodeptr _Buynode_if_nil (_Nil, _Valty &&_Val)
 
void _Destroy_if_not_nil (_Nodeptr _Newnode)
 
void _Destroy_if_not_nil (_Nil)
 
template<class _Valty , class _Nodety >
iterator _Insert_hint (const_iterator _Where, _Valty &&_Val, _Nodety _Newnode)
 
template<class _Valty , class _Nodety >
_Pairib _Insert_nohint (bool _Leftish, _Valty &&_Val, _Nodety _Newnode)
 
template<class _Valty , class _Nodety >
iterator _Insert_at (bool _Addleft, _Nodeptr _Wherenode, _Valty &&_Val, _Nodety _Node)
 
template<class _Moveit >
void _Copy (const _Myt &_Right, _Moveit _Movefl)
 
template<class _Want_to_move , class _Can_move , class _Is_set , class _Dummy >
_Nodeptr _Copy_or_move (_Nodeptr _Rootnode, _Want_to_move, _Can_move, _Is_set, _Dummy)
 
template<class _Dummy >
_Nodeptr _Copy_or_move (_Nodeptr _Rootnode, true_type, true_type, true_type, _Dummy)
 
template<class _Dummy >
_Nodeptr _Copy_or_move (_Nodeptr _Rootnode, true_type, true_type, false_type, _Dummy)
 
template<class _Moveit >
_Nodeptr _Copy_nodes (_Nodeptr _Rootnode, _Nodeptr _Wherenode, _Moveit _Movefl)
 
_Paircc _Eqrange (const key_type &_Keyval) const
 
_Pairii _Eqrange (const key_type &_Keyval)
 
void _Erase (_Nodeptr _Rootnode)
 
_Nodeptr _Lbound (const key_type &_Keyval) const
 
_Nodeptr _Lbound (const key_type &_Keyval)
 
_Nodeptr_Lmost () const
 
void _Lrotate (_Nodeptr _Wherenode)
 
_Nodeptr_Rmost () const
 
_Nodeptr_Root () const
 
void _Rrotate (_Nodeptr _Wherenode)
 
_Nodeptr _Ubound (const key_type &_Keyval) const
 
_Nodeptr _Ubound (const key_type &_Keyval)
 
void _Tidy ()
 
const key_type_Kfn (const value_type &_Val) const
 
const key_type_Key (_Nodeptr _Pnode) const
 

Additional Inherited Members

- Static Public Member Functions inherited from _Tree_val< _Tree_base_types< _Traits::value_type, _Traits::allocator_type >::_Val_types >
static char & _Color (_Nodeptr _Pnode)
 
static char & _Isnil (_Nodeptr _Pnode)
 
static _Nodepref _Left (_Nodeptr _Pnode)
 
static _Nodepref _Parent (_Nodeptr _Pnode)
 
static _Nodepref _Right (_Nodeptr _Pnode)
 
static reference _Myval (_Nodeptr _Pnode)
 
static _Nodeptr _Max (_Nodeptr _Pnode)
 
static _Nodeptr _Min (_Nodeptr _Pnode)
 
- Public Attributes inherited from _Tree_comp< !is_empty< _Traits::key_compare >::value, _Traits >
key_compare comp
 
- Public Attributes inherited from _Tree_alloc<!is_empty< _Traits::allocator_type >::value, _Tree_base_types< _Traits::value_type, _Traits::allocator_type > >
_Tree_base_types< _Traits::value_type, _Traits::allocator_type >::_Alnod_type _Alnod
 
- Public Attributes inherited from _Tree_val< _Tree_base_types< _Traits::value_type, _Traits::allocator_type >::_Val_types >
_Nodeptr _Myhead
 
size_type _Mysize
 

Member Typedef Documentation

template<class _Traits>
typedef _Mybase::_Alty _Tree< _Traits >::_Alty
template<class _Traits>
typedef _Tree_comp< !is_empty<typename _Traits::key_compare>::value, _Traits> _Tree< _Traits >::_Mybase
template<class _Traits>
typedef _Tree<_Traits> _Tree< _Traits >::_Myt
template<class _Traits>
typedef _Mybase::_Node _Tree< _Traits >::_Node
template<class _Traits>
typedef _Mybase::_Nodeptr _Tree< _Traits >::_Nodeptr
template<class _Traits>
typedef pair<const_iterator, const_iterator> _Tree< _Traits >::_Paircc
template<class _Traits>
typedef pair<iterator, bool> _Tree< _Traits >::_Pairib
template<class _Traits>
typedef pair<iterator, iterator> _Tree< _Traits >::_Pairii
template<class _Traits>
typedef _Mybase::allocator_type _Tree< _Traits >::allocator_type
template<class _Traits>
typedef _Mybase::const_iterator _Tree< _Traits >::const_iterator
template<class _Traits>
typedef _Mybase::const_pointer _Tree< _Traits >::const_pointer
template<class _Traits>
typedef _Mybase::const_reference _Tree< _Traits >::const_reference
template<class _Traits>
typedef _STD reverse_iterator<const_iterator> _Tree< _Traits >::const_reverse_iterator
template<class _Traits>
typedef _Mybase::difference_type _Tree< _Traits >::difference_type
template<class _Traits>
typedef _If<is_same<key_type, value_type>::value, typename _Mybase::const_iterator, typename _Mybase::iterator>::type _Tree< _Traits >::iterator
template<class _Traits>
typedef _Mybase::key_compare _Tree< _Traits >::key_compare
template<class _Traits>
typedef _Traits::key_type _Tree< _Traits >::key_type
template<class _Traits>
typedef _Mybase::pointer _Tree< _Traits >::pointer
template<class _Traits>
typedef _Mybase::reference _Tree< _Traits >::reference
template<class _Traits>
typedef _STD reverse_iterator<iterator> _Tree< _Traits >::reverse_iterator
template<class _Traits>
typedef _Mybase::size_type _Tree< _Traits >::size_type
template<class _Traits>
typedef _Traits::value_compare _Tree< _Traits >::value_compare
template<class _Traits>
typedef _Mybase::value_type _Tree< _Traits >::value_type

Member Enumeration Documentation

template<class _Traits>
anonymous enum
Enumerator
_Multi 
1033  { // get multi parameter
1034  _Multi = _Traits::_Multi};
Definition: xtree:1034

Constructor & Destructor Documentation

template<class _Traits>
_Tree< _Traits >::_Tree ( const key_compare _Parg,
const allocator_type _Al 
)
inline
1065  : _Mybase(_Parg, _Al)
1066  { // construct empty tree
1067  }
_Tree_comp< !is_empty< typename _Traits::key_compare >::value, _Traits > _Mybase
Definition: xtree:1028
template<class _Traits>
_Tree< _Traits >::_Tree ( const value_type _First,
const value_type _Last,
const key_compare _Parg,
const allocator_type _Al 
)
inline
1071  : _Mybase(_Parg, _Al)
1072  { // construct tree from [_First, _Last) array
1073  _TRY_BEGIN
1074  insert(_First, _Last);
1075  _CATCH_ALL
1076  _Tidy();
1077  _RERAISE;
1078  _CATCH_END
1079  }
_Pairib insert(value_type &&_Val)
Definition: xtree:1141
#define _TRY_BEGIN
Definition: xstddef:60
#define _CATCH_END
Definition: xstddef:63
#define _CATCH_ALL
Definition: xstddef:62
void _Tidy()
Definition: xtree:2228
_Tree_comp< !is_empty< typename _Traits::key_compare >::value, _Traits > _Mybase
Definition: xtree:1028
#define _RERAISE
Definition: xstddef:74
_FwdIt _Last
Definition: algorithm:1936
template<class _Traits>
_Tree< _Traits >::_Tree ( const _Myt _Right,
const allocator_type _Al 
)
inline
1082  : _Mybase(_Right.key_comp(), _Al)
1083  { // construct tree by copying _Right, allocator
1084  _TRY_BEGIN
1085  _Copy(_Right, false_type());
1086  _CATCH_ALL
1087  _Tidy();
1088  _RERAISE;
1089  _CATCH_END
1090  }
#define _TRY_BEGIN
Definition: xstddef:60
#define _CATCH_END
Definition: xstddef:63
integral_constant< bool, false > false_type
Definition: xtr1common:48
#define _CATCH_ALL
Definition: xstddef:62
void _Copy(const _Myt &_Right, _Moveit _Movefl)
Definition: xtree:1927
void _Tidy()
Definition: xtree:2228
_Tree_comp< !is_empty< typename _Traits::key_compare >::value, _Traits > _Mybase
Definition: xtree:1028
#define _RERAISE
Definition: xstddef:74
template<class _Traits>
_Tree< _Traits >::_Tree ( _Myt &&  _Right)
inline
1093  : _Mybase(_Right.key_comp(), _Right._Getal())
1094  { // construct tree by moving _Right
1095  _Assign_rv(_STD forward<_Myt>(_Right), true_type());
1096  }
void _Assign_rv(_Myt &&_Right, true_type)
Definition: xtree:1118
integral_constant< bool, true > true_type
Definition: xtr1common:47
_Tree_comp< !is_empty< typename _Traits::key_compare >::value, _Traits > _Mybase
Definition: xtree:1028
template<class _Traits>
_Tree< _Traits >::_Tree ( _Myt &&  _Right,
const allocator_type _Al 
)
inline
1099  : _Mybase(_Right.key_comp(), _Al)
1100  { // construct tree by moving _Right, allocator
1101  _Assign_rv(_STD forward<_Myt>(_Right));
1102  }
void _Assign_rv(_Myt &&_Right, true_type)
Definition: xtree:1118
_Tree_comp< !is_empty< typename _Traits::key_compare >::value, _Traits > _Mybase
Definition: xtree:1028
template<class _Traits>
_Tree< _Traits >::~_Tree ( )
inline
1191  { // destroy tree
1192  _Tidy();
1193  }
void _Tidy()
Definition: xtree:2228

Member Function Documentation

template<class _Traits>
void _Tree< _Traits >::_Assign_rv ( _Myt &&  _Right,
true_type   
)
inline
1119  { // move from _Right, stealing its contents
1120  this->_Swap_all(_Right);
1121  this->_Swapcomp(_Right._Getcomp());
1122  _Swap_adl(this->_Myhead, _Right._Myhead);
1123  _STD swap(this->_Mysize, _Right._Mysize);
1124  }
void swap(_Myt &_Right)
Definition: xtree:1603
void _Swapcomp(key_compare &_Right)
Definition: xtree:979
void _Swap_all(_Container_base0 &)
Definition: xutility:46
template<class _Traits>
void _Tree< _Traits >::_Assign_rv ( _Myt &&  _Right,
false_type   
)
inline
1127  { // move from _Right, possibly moving its contents
1128  if (get_allocator() == _Right.get_allocator())
1129  _Assign_rv(_STD forward<_Myt>(_Right), true_type());
1130  else
1131  _Copy(_Right, true_type());
1132  }
void _Assign_rv(_Myt &&_Right, true_type)
Definition: xtree:1118
void _Copy(const _Myt &_Right, _Moveit _Movefl)
Definition: xtree:1927
allocator_type get_allocator() const _NOEXCEPT
Definition: xtree:1285
integral_constant< bool, true > true_type
Definition: xtr1common:47
template<class _Traits>
void _Tree< _Traits >::_Assign_rv ( _Myt &&  _Right)
inline
1135  { // assign by moving _Right
1136  _Assign_rv(_STD forward<_Myt>(_Right),
1137  typename _Alty::propagate_on_container_move_assignment());
1138  }
void _Assign_rv(_Myt &&_Right, true_type)
Definition: xtree:1118
template<class _Traits>
template<class _Valty >
_Nodeptr _Tree< _Traits >::_Buynode_if_nil ( _Nodeptr  _Node,
_Valty &&   
)
inlineprotected
1637  { // node exists, just return it
1638  return (_Node);
1639  }
_Mybase::_Node _Node
Definition: xtree:1036
template<class _Traits>
template<class _Valty >
_Nodeptr _Tree< _Traits >::_Buynode_if_nil ( _Nil  ,
_Valty &&  _Val 
)
inlineprotected
1643  { // node doesn't exist, make it
1644  return (this->_Buynode(_STD forward<_Valty>(_Val)));
1645  }
_Nodeptr _Buynode(_Valty &&..._Val)
Definition: xtree:923
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Traits>
template<class _Moveit >
void _Tree< _Traits >::_Copy ( const _Myt _Right,
_Moveit  _Movefl 
)
inlineprotected
1929  { // copy or move entire tree from _Right
1930  _Root() = _Copy_nodes(_Right._Root(), this->_Myhead, _Movefl);
1931  this->_Mysize = _Right.size();
1932  if (!this->_Isnil(_Root()))
1933  { // nonempty tree, look for new smallest and largest
1934  _Lmost() = this->_Min(_Root());
1935  _Rmost() = this->_Max(_Root());
1936  }
1937  else
1938  { // empty tree, just tidy head pointers
1939  _Lmost() = this->_Myhead;
1940  _Rmost() = this->_Myhead;
1941  }
1942  }
_Nodeptr & _Lmost() const
Definition: xtree:2121
_Nodeptr & _Rmost() const
Definition: xtree:2146
_Nodeptr & _Root() const
Definition: xtree:2151
_Nodeptr _Copy_nodes(_Nodeptr _Rootnode, _Nodeptr _Wherenode, _Moveit _Movefl)
Definition: xtree:1974
template<class _Traits>
template<class _Moveit >
_Nodeptr _Tree< _Traits >::_Copy_nodes ( _Nodeptr  _Rootnode,
_Nodeptr  _Wherenode,
_Moveit  _Movefl 
)
inlineprotected
1976  { // copy entire subtree, recursively
1977  _Nodeptr _Newroot = this->_Myhead; // point at nil node
1978 
1979  if (!this->_Isnil(_Rootnode))
1980  { // copy or move a node, then any subtrees
1981  _Nodeptr _Pnode = _Copy_or_move(_Rootnode, _Movefl,
1983  typename is_same<key_type, value_type>::type(), 0);
1984  _Pnode->_Parent = _Wherenode;
1985  _Pnode->_Color = this->_Color(_Rootnode);
1986  if (this->_Isnil(_Newroot))
1987  _Newroot = _Pnode; // memorize new root
1988 
1989  _TRY_BEGIN
1990  this->_Left(_Pnode) =
1991  _Copy_nodes(this->_Left(_Rootnode), _Pnode, _Movefl);
1992  this->_Right(_Pnode) =
1993  _Copy_nodes(this->_Right(_Rootnode), _Pnode, _Movefl);
1994  _CATCH_ALL
1995  _Erase(_Newroot); // subtree copy failed, bail out
1996  _RERAISE;
1997  _CATCH_END
1998  }
1999 
2000  return (_Newroot); // return newly constructed tree
2001  }
Definition: xtr1common:34
#define _TRY_BEGIN
Definition: xstddef:60
#define _CATCH_END
Definition: xstddef:63
_Mybase::_Nodeptr _Nodeptr
Definition: xtree:1037
_Nodeptr _Copy_or_move(_Nodeptr _Rootnode, _Want_to_move, _Can_move, _Is_set, _Dummy)
Definition: xtree:1948
void _Erase(_Nodeptr _Rootnode)
Definition: xtree:2073
#define _CATCH_ALL
Definition: xstddef:62
#define _RERAISE
Definition: xstddef:74
_Nodeptr _Copy_nodes(_Nodeptr _Rootnode, _Nodeptr _Wherenode, _Moveit _Movefl)
Definition: xtree:1974
template<class _Traits>
template<class _Want_to_move , class _Can_move , class _Is_set , class _Dummy >
_Nodeptr _Tree< _Traits >::_Copy_or_move ( _Nodeptr  _Rootnode,
_Want_to_move  ,
_Can_move  ,
_Is_set  ,
_Dummy   
)
inlineprotected
1950  { // copy to new node -- nonmovable
1951  return (this->_Buynode(this->_Myval(_Rootnode)));
1952  }
_Nodeptr _Buynode(_Valty &&..._Val)
Definition: xtree:923
template<class _Traits>
template<class _Dummy >
_Nodeptr _Tree< _Traits >::_Copy_or_move ( _Nodeptr  _Rootnode,
true_type  ,
true_type  ,
true_type  ,
_Dummy   
)
inlineprotected
1957  { // move to new node -- movable, set
1958  return (this->_Buynode(
1959  _STD forward<value_type>(this->_Myval(_Rootnode))));
1960  }
_Nodeptr _Buynode(_Valty &&..._Val)
Definition: xtree:923
template<class _Traits>
template<class _Dummy >
_Nodeptr _Tree< _Traits >::_Copy_or_move ( _Nodeptr  _Rootnode,
true_type  ,
true_type  ,
false_type  ,
_Dummy   
)
inlineprotected
1965  { // move to new node -- movable, map
1966  return (this->_Buynode(
1967  _STD forward<key_type>(const_cast<key_type&>(
1968  this->_Myval(_Rootnode).first)),
1969  _STD forward<typename value_type::second_type>(this->_Myval(
1970  _Rootnode).second)));
1971  }
_Nodeptr _Buynode(_Valty &&..._Val)
Definition: xtree:923
template<class _Traits>
void _Tree< _Traits >::_Destroy_if_not_nil ( _Nodeptr  _Newnode)
inlineprotected
1648  { // node exists, destroy it
1649  this->_Getal().destroy(
1650  _STD addressof(this->_Myval(_Newnode)));
1651 
1652  this->_Getal().deallocate(_Newnode, 1);
1653  }
_Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:91
template<class _Traits>
void _Tree< _Traits >::_Destroy_if_not_nil ( _Nil  )
inlineprotected
1656  { // node doesn't exist, do nothing
1657  }
template<class _Traits>
_Paircc _Tree< _Traits >::_Eqrange ( const key_type _Keyval) const
inlineprotected
2004  { // find leftmost node not less than _Keyval
2005  _Nodeptr _Pnode = _Root();
2006  _Nodeptr _Lonode = this->_Myhead; // end() if search fails
2007  _Nodeptr _Hinode = this->_Myhead; // end() if search fails
2008 
2009  while (!this->_Isnil(_Pnode))
2010  if (_DEBUG_LT_PRED(this->_Getcomp(), this->_Key(_Pnode), _Keyval))
2011  _Pnode = this->_Right(_Pnode); // descend right subtree
2012  else
2013  { // _Pnode not less than _Keyval, remember it
2014  if (this->_Isnil(_Hinode)
2015  && _DEBUG_LT_PRED(this->_Getcomp(), _Keyval,
2016  this->_Key(_Pnode)))
2017  _Hinode = _Pnode; // _Pnode greater, remember it
2018  _Lonode = _Pnode;
2019  _Pnode = this->_Left(_Pnode); // descend left subtree
2020  }
2021 
2022  _Pnode = this->_Isnil(_Hinode) ? _Root()
2023  : this->_Left(_Hinode); // continue scan for upper bound
2024  while (!this->_Isnil(_Pnode))
2025  if (_DEBUG_LT_PRED(this->_Getcomp(), _Keyval, this->_Key(_Pnode)))
2026  { // _Pnode greater than _Keyval, remember it
2027  _Hinode = _Pnode;
2028  _Pnode = this->_Left(_Pnode); // descend left subtree
2029  }
2030  else
2031  _Pnode = this->_Right(_Pnode); // descend right subtree
2032 
2033  const_iterator _First = const_iterator(_Lonode, this);
2034  const_iterator _Last = const_iterator(_Hinode, this);
2035  return (_Paircc(_First, _Last));
2036  }
#define _DEBUG_LT_PRED(pred, x, y)
Definition: xutility:462
_Mybase::const_iterator const_iterator
Definition: xtree:1051
const key_type & _Key(_Nodeptr _Pnode) const
Definition: xtree:2238
_Mybase::_Nodeptr _Nodeptr
Definition: xtree:1037
pair< const_iterator, const_iterator > _Paircc
Definition: xtree:1061
_Nodeptr & _Root() const
Definition: xtree:2151
_FwdIt _Last
Definition: algorithm:1936
template<class _Traits>
_Pairii _Tree< _Traits >::_Eqrange ( const key_type _Keyval)
inlineprotected
2039  { // find leftmost node not less than _Keyval
2040  _Nodeptr _Pnode = _Root();
2041  _Nodeptr _Lonode = this->_Myhead; // end() if search fails
2042  _Nodeptr _Hinode = this->_Myhead; // end() if search fails
2043 
2044  while (!this->_Isnil(_Pnode))
2045  if (_DEBUG_LT_PRED(this->_Getcomp(), this->_Key(_Pnode), _Keyval))
2046  _Pnode = this->_Right(_Pnode); // descend right subtree
2047  else
2048  { // _Pnode not less than _Keyval, remember it
2049  if (this->_Isnil(_Hinode)
2050  && _DEBUG_LT_PRED(this->_Getcomp(), _Keyval,
2051  this->_Key(_Pnode)))
2052  _Hinode = _Pnode; // _Pnode greater, remember it
2053  _Lonode = _Pnode;
2054  _Pnode = this->_Left(_Pnode); // descend left subtree
2055  }
2056 
2057  _Pnode = this->_Isnil(_Hinode) ? _Root()
2058  : this->_Left(_Hinode); // continue scan for upper bound
2059  while (!this->_Isnil(_Pnode))
2060  if (_DEBUG_LT_PRED(this->_Getcomp(), _Keyval, this->_Key(_Pnode)))
2061  { // _Pnode greater than _Keyval, remember it
2062  _Hinode = _Pnode;
2063  _Pnode = this->_Left(_Pnode); // descend left subtree
2064  }
2065  else
2066  _Pnode = this->_Right(_Pnode); // descend right subtree
2067 
2068  iterator _First = iterator(_Lonode, this);
2069  iterator _Last = iterator(_Hinode, this);
2070  return (_Pairii(_First, _Last));
2071  }
#define _DEBUG_LT_PRED(pred, x, y)
Definition: xutility:462
Definition: xutility:337
_If< is_same< key_type, value_type >::value, typename _Mybase::const_iterator, typename _Mybase::iterator >::type iterator
Definition: xtree:1054
const key_type & _Key(_Nodeptr _Pnode) const
Definition: xtree:2238
_Mybase::_Nodeptr _Nodeptr
Definition: xtree:1037
pair< iterator, iterator > _Pairii
Definition: xtree:1060
_Nodeptr & _Root() const
Definition: xtree:2151
_FwdIt _Last
Definition: algorithm:1936
template<class _Traits>
void _Tree< _Traits >::_Erase ( _Nodeptr  _Rootnode)
inlineprotected
2074  { // free entire subtree, recursively
2075  for (_Nodeptr _Pnode = _Rootnode;
2076  !this->_Isnil(_Pnode); _Rootnode = _Pnode)
2077  { // free subtrees, then node
2078  _Erase(this->_Right(_Pnode));
2079  _Pnode = this->_Left(_Pnode);
2080  this->_Getal().destroy(
2081  _STD addressof(this->_Myval(_Rootnode)));
2082 
2083  this->_Getal().deallocate(_Rootnode, 1);
2084  }
2085  }
_Mybase::_Nodeptr _Nodeptr
Definition: xtree:1037
void _Erase(_Nodeptr _Rootnode)
Definition: xtree:2073
_Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:91
template<class _Traits>
template<class _Valty , class _Nodety >
iterator _Tree< _Traits >::_Insert_at ( bool  _Addleft,
_Nodeptr  _Wherenode,
_Valty &&  _Val,
_Nodety  _Node 
)
inlineprotected
1835  { // add node with value next to _Wherenode, to left if _Addleft
1836  if (max_size() - 1 <= this->_Mysize)
1837  { // tree would get too big, fail
1839  _Xlength_error("map/set<T> too long");
1840  }
1841  _Nodeptr _Newnode = _Buynode_if_nil(_Node,
1842  _STD forward<_Valty>(_Val));
1843 
1844  ++this->_Mysize;
1845  _Newnode->_Parent = _Wherenode;
1846 
1847  if (_Wherenode == this->_Myhead)
1848  { // first node in tree, just set head values
1849  _Root() = _Newnode;
1850  _Lmost() = _Newnode;
1851  _Rmost() = _Newnode;
1852  }
1853  else if (_Addleft)
1854  { // add to left of _Wherenode
1855  this->_Left(_Wherenode) = _Newnode;
1856  if (_Wherenode == _Lmost())
1857  _Lmost() = _Newnode;
1858  }
1859  else
1860  { // add to right of _Wherenode
1861  this->_Right(_Wherenode) = _Newnode;
1862  if (_Wherenode == _Rmost())
1863  _Rmost() = _Newnode;
1864  }
1865 
1866  for (_Nodeptr _Pnode = _Newnode;
1867  this->_Color(this->_Parent(_Pnode)) == this->_Red; )
1868  if (this->_Parent(_Pnode)
1869  == this->_Left(this->_Parent(this->_Parent(_Pnode))))
1870  { // fixup red-red in left subtree
1871  _Wherenode =
1872  this->_Right(this->_Parent(this->_Parent(_Pnode)));
1873  if (this->_Color(_Wherenode) == this->_Red)
1874  { // parent has two red children, blacken both
1875  this->_Color(this->_Parent(_Pnode)) = this->_Black;
1876  this->_Color(_Wherenode) = this->_Black;
1877  this->_Color(this->_Parent(this->_Parent(_Pnode)))
1878  = this->_Red;
1879  _Pnode = this->_Parent(this->_Parent(_Pnode));
1880  }
1881  else
1882  { // parent has red and black children
1883  if (_Pnode == this->_Right(this->_Parent(_Pnode)))
1884  { // rotate right child to left
1885  _Pnode = this->_Parent(_Pnode);
1886  _Lrotate(_Pnode);
1887  }
1888  this->_Color(this->_Parent(_Pnode)) =
1889  this->_Black; // propagate red up
1890  this->_Color(this->_Parent(this->_Parent(_Pnode))) =
1891  this->_Red;
1892  _Rrotate(this->_Parent(this->_Parent(_Pnode)));
1893  }
1894  }
1895  else
1896  { // fixup red-red in right subtree
1897  _Wherenode =
1898  this->_Left(this->_Parent(this->_Parent(_Pnode)));
1899  if (this->_Color(_Wherenode) == this->_Red)
1900  { // parent has two red children, blacken both
1901  this->_Color(this->_Parent(_Pnode)) = this->_Black;
1902  this->_Color(_Wherenode) = this->_Black;
1903  this->_Color(this->_Parent(this->_Parent(_Pnode))) =
1904  this->_Red;
1905  _Pnode = this->_Parent(this->_Parent(_Pnode));
1906  }
1907  else
1908  { // parent has red and black children
1909  if (_Pnode == this->_Left(this->_Parent(_Pnode)))
1910  { // rotate left child to right
1911  _Pnode = this->_Parent(_Pnode);
1912  _Rrotate(_Pnode);
1913  }
1914  this->_Color(this->_Parent(_Pnode)) =
1915  this->_Black; // propagate red up
1916  this->_Color(this->_Parent(this->_Parent(_Pnode))) =
1917  this->_Red;
1918  _Lrotate(this->_Parent(this->_Parent(_Pnode)));
1919  }
1920  }
1921 
1922  this->_Color(_Root()) = this->_Black; // root is always black
1923  return (iterator(_Newnode, this));
1924  }
void _Lrotate(_Nodeptr _Wherenode)
Definition: xtree:2126
void _Destroy_if_not_nil(_Nodeptr _Newnode)
Definition: xtree:1647
_Nodeptr & _Lmost() const
Definition: xtree:2121
_Nodeptr & _Rmost() const
Definition: xtree:2146
_Mybase::_Node _Node
Definition: xtree:1036
void _Rrotate(_Nodeptr _Wherenode)
Definition: xtree:2156
_If< is_same< key_type, value_type >::value, typename _Mybase::const_iterator, typename _Mybase::iterator >::type iterator
Definition: xtree:1054
_Mybase::_Nodeptr _Nodeptr
Definition: xtree:1037
_Nodeptr _Buynode_if_nil(_Nodeptr _Node, _Valty &&)
Definition: xtree:1636
_Nodeptr & _Root() const
Definition: xtree:2151
size_type max_size() const _NOEXCEPT
Definition: xtree:1275
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Traits>
template<class _Valty , class _Nodety >
iterator _Tree< _Traits >::_Insert_hint ( const_iterator  _Where,
_Valty &&  _Val,
_Nodety  _Newnode 
)
inlineprotected
1663  { // try to insert node using _Where as a hint
1664  const_iterator _Next;
1665  bool _Leftish = false; // assume nearest point is end of sequence
1666 
1667  _TRY_BEGIN
1668 
1669  #if _ITERATOR_DEBUG_LEVEL == 2
1670  if (_Where._Getcont() != this)
1671  _DEBUG_ERROR("map/set insert iterator outside range");
1672  #endif /* _ITERATOR_DEBUG_LEVEL == 2 */
1673 
1674  if (size() == 0)
1675  return (_Insert_at(true, this->_Myhead,
1676  _STD forward<_Valty>(_Val), _Newnode)); // empty tree
1677  else if (this->_Multi)
1678  { // insert even if duplicate
1679  if (_Where == begin())
1680  { // insert at beginning if before first element
1681  if (!_DEBUG_LT_PRED(this->_Getcomp(),
1682  this->_Key(_Where._Mynode()), this->_Kfn(_Val)))
1683  return (_Insert_at(true, _Where._Mynode(),
1684  _STD forward<_Valty>(_Val), _Newnode));
1685  _Leftish = true; // nearest point is beginning of sequence
1686  }
1687  else if (_Where == end())
1688  { // insert at end if after last element
1689  if (!_DEBUG_LT_PRED(this->_Getcomp(),
1690  this->_Kfn(_Val), this->_Key(_Rmost())))
1691  return (_Insert_at(false, _Rmost(),
1692  _STD forward<_Valty>(_Val), _Newnode));
1693  }
1694  else if (!_DEBUG_LT_PRED(this->_Getcomp(),
1695  this->_Key(_Where._Mynode()), this->_Kfn(_Val))
1696  && !_DEBUG_LT_PRED(this->_Getcomp(),
1697  this->_Kfn(_Val),
1698  this->_Key((--(_Next = _Where))._Mynode())))
1699  { // insert before _Where
1700  if (this->_Isnil(this->_Right(_Next._Mynode())))
1701  return (_Insert_at(false, _Next._Mynode(),
1702  _STD forward<_Valty>(_Val), _Newnode));
1703  else
1704  return (_Insert_at(true, _Where._Mynode(),
1705  _STD forward<_Valty>(_Val), _Newnode));
1706  }
1707  else if (!_DEBUG_LT_PRED(this->_Getcomp(),
1708  this->_Kfn(_Val), this->_Key(_Where._Mynode()))
1709  && (++(_Next = _Where) == end()
1710  || !_DEBUG_LT_PRED(this->_Getcomp(),
1711  this->_Key(_Next._Mynode()), this->_Kfn(_Val))))
1712  { // insert after _Where
1713  if (this->_Isnil(this->_Right(_Where._Mynode())))
1714  return (_Insert_at(false, _Where._Mynode(),
1715  _STD forward<_Valty>(_Val), _Newnode));
1716  else
1717  return (_Insert_at(true, _Next._Mynode(),
1718  _STD forward<_Valty>(_Val), _Newnode));
1719  }
1720  else
1721  _Leftish = true; // nearest point is beginning of sequence
1722  }
1723  else
1724  { // insert only if unique
1725  if (_Where == begin())
1726  { // insert at beginning if before first element
1727  if (_DEBUG_LT_PRED(this->_Getcomp(),
1728  this->_Kfn(_Val), this->_Key(_Where._Mynode())))
1729  return (_Insert_at(true, _Where._Mynode(),
1730  _STD forward<_Valty>(_Val), _Newnode));
1731  }
1732  else if (_Where == end())
1733  { // insert at end if after last element
1734  if (_DEBUG_LT_PRED(this->_Getcomp(),
1735  this->_Key(_Rmost()), this->_Kfn(_Val)))
1736  return (_Insert_at(false, _Rmost(),
1737  _STD forward<_Valty>(_Val), _Newnode));
1738  }
1739  else if (_DEBUG_LT_PRED(this->_Getcomp(),
1740  this->_Kfn(_Val), this->_Key(_Where._Mynode()))
1741  && _DEBUG_LT_PRED(this->_Getcomp(),
1742  this->_Key((--(_Next = _Where))._Mynode()),
1743  this->_Kfn(_Val)))
1744  { // insert before _Where
1745  if (this->_Isnil(this->_Right(_Next._Mynode())))
1746  return (_Insert_at(false, _Next._Mynode(),
1747  _STD forward<_Valty>(_Val), _Newnode));
1748  else
1749  return (_Insert_at(true, _Where._Mynode(),
1750  _STD forward<_Valty>(_Val), _Newnode));
1751  }
1752  else if (_DEBUG_LT_PRED(this->_Getcomp(),
1753  this->_Key(_Where._Mynode()), this->_Kfn(_Val))
1754  && (++(_Next = _Where) == end()
1755  || _DEBUG_LT_PRED(this->_Getcomp(),
1756  this->_Kfn(_Val), this->_Key(_Next._Mynode()))))
1757  { // insert after _Where
1758  if (this->_Isnil(this->_Right(_Where._Mynode())))
1759  return (_Insert_at(false, _Where._Mynode(),
1760  _STD forward<_Valty>(_Val), _Newnode));
1761  else
1762  return (_Insert_at(true, _Next._Mynode(),
1763  _STD forward<_Valty>(_Val), _Newnode));
1764  }
1765  }
1766  _CATCH_ALL
1767  _Destroy_if_not_nil(_Newnode);
1768  _RERAISE;
1769  _CATCH_END
1770 
1771  return (_Insert_nohint(_Leftish,
1772  _STD forward<_Valty>(_Val), _Newnode).first);
1773  }
void _Destroy_if_not_nil(_Nodeptr _Newnode)
Definition: xtree:1647
#define _TRY_BEGIN
Definition: xstddef:60
#define _CATCH_END
Definition: xstddef:63
#define _DEBUG_LT_PRED(pred, x, y)
Definition: xutility:462
_Nodeptr & _Rmost() const
Definition: xtree:2146
_Mybase::const_iterator const_iterator
Definition: xtree:1051
iterator _Insert_at(bool _Addleft, _Nodeptr _Wherenode, _Valty &&_Val, _Nodety _Node)
Definition: xtree:1833
Definition: xtree:1034
iterator end() _NOEXCEPT
Definition: xtree:1220
const key_type & _Key(_Nodeptr _Pnode) const
Definition: xtree:2238
#define _CATCH_ALL
Definition: xstddef:62
iterator begin() _NOEXCEPT
Definition: xtree:1210
#define _DEBUG_ERROR(mesg)
Definition: xutility:32
_Pairib _Insert_nohint(bool _Leftish, _Valty &&_Val, _Nodety _Newnode)
Definition: xtree:1777
size_type size() const _NOEXCEPT
Definition: xtree:1270
#define _RERAISE
Definition: xstddef:74
_FwdIt const _Ty _Val
Definition: algorithm:1938
const key_type & _Kfn(const value_type &_Val) const
Definition: xtree:2233
template<class _Traits>
template<class _Valty , class _Nodety >
_Pairib _Tree< _Traits >::_Insert_nohint ( bool  _Leftish,
_Valty &&  _Val,
_Nodety  _Newnode 
)
inlineprotected
1779  { // try to insert node, on left if _Leftish
1780  _TRY_BEGIN
1781  _Nodeptr _Trynode = _Root();
1782  _Nodeptr _Wherenode = this->_Myhead;
1783  bool _Addleft = true; // add to left of head if tree empty
1784 
1785  while (!this->_Isnil(_Trynode))
1786  { // look for leaf to insert before (_Addleft) or after
1787  _Wherenode = _Trynode;
1788  if (_Leftish)
1789  _Addleft = !_DEBUG_LT_PRED(this->_Getcomp(),
1790  this->_Key(_Trynode),
1791  this->_Kfn(_Val)); // favor left end
1792  else
1793  _Addleft = _DEBUG_LT_PRED(this->_Getcomp(),
1794  this->_Kfn(_Val),
1795  this->_Key(_Trynode)); // favor right end
1796  _Trynode = _Addleft ? this->_Left(_Trynode)
1797  : this->_Right(_Trynode);
1798  }
1799 
1800  if (this->_Multi)
1801  return (_Pairib(_Insert_at(_Addleft, _Wherenode,
1802  _STD forward<_Valty>(_Val), _Newnode), true));
1803  else
1804  { // insert only if unique
1805  iterator _Where = iterator(_Wherenode, this);
1806  if (!_Addleft)
1807  ; // need to test if insert after is okay
1808  else if (_Where == begin())
1809  return (_Pairib(_Insert_at(true, _Wherenode,
1810  _STD forward<_Valty>(_Val), _Newnode), true));
1811  else
1812  --_Where; // need to test if insert before is okay
1813 
1814  if (_DEBUG_LT_PRED(this->_Getcomp(),
1815  this->_Key(_Where._Mynode()),
1816  this->_Kfn(_Val)))
1817  return (_Pairib(_Insert_at(_Addleft, _Wherenode,
1818  _STD forward<_Valty>(_Val), _Newnode), true));
1819  else
1820  { // duplicate, don't insert
1821  _Destroy_if_not_nil(_Newnode);
1822  return (_Pairib(_Where, false));
1823  }
1824  }
1825  _CATCH_ALL
1826  _Destroy_if_not_nil(_Newnode);
1827  _RERAISE;
1828  _CATCH_END
1829  }
void _Destroy_if_not_nil(_Nodeptr _Newnode)
Definition: xtree:1647
#define _TRY_BEGIN
Definition: xstddef:60
#define _CATCH_END
Definition: xstddef:63
#define _DEBUG_LT_PRED(pred, x, y)
Definition: xutility:462
Definition: xutility:337
pair< iterator, bool > _Pairib
Definition: xtree:1059
iterator _Insert_at(bool _Addleft, _Nodeptr _Wherenode, _Valty &&_Val, _Nodety _Node)
Definition: xtree:1833
Definition: xtree:1034
_If< is_same< key_type, value_type >::value, typename _Mybase::const_iterator, typename _Mybase::iterator >::type iterator
Definition: xtree:1054
const key_type & _Key(_Nodeptr _Pnode) const
Definition: xtree:2238
_Mybase::_Nodeptr _Nodeptr
Definition: xtree:1037
_Nodeptr & _Root() const
Definition: xtree:2151
#define _CATCH_ALL
Definition: xstddef:62
iterator begin() _NOEXCEPT
Definition: xtree:1210
#define _RERAISE
Definition: xstddef:74
_FwdIt const _Ty _Val
Definition: algorithm:1938
const key_type & _Kfn(const value_type &_Val) const
Definition: xtree:2233
template<class _Traits>
const key_type& _Tree< _Traits >::_Key ( _Nodeptr  _Pnode) const
inlineprotected
2239  { // return reference to key in node
2240  return ((const key_type&)this->_Kfn(this->_Myval(_Pnode)));
2241  }
_Traits::key_type key_type
Definition: xtree:1030
const key_type & _Kfn(const value_type &_Val) const
Definition: xtree:2233
template<class _Traits>
const key_type& _Tree< _Traits >::_Kfn ( const value_type _Val) const
inlineprotected
2234  { // get key from value
2235  return (_Traits::_Kfn(_Val));
2236  }
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Traits>
_Nodeptr _Tree< _Traits >::_Lbound ( const key_type _Keyval) const
inlineprotected
2088  { // find leftmost node not less than _Keyval
2089  _Nodeptr _Pnode = _Root();
2090  _Nodeptr _Wherenode = this->_Myhead; // end() if search fails
2091 
2092  while (!this->_Isnil(_Pnode))
2093  if (_DEBUG_LT_PRED(this->_Getcomp(), this->_Key(_Pnode), _Keyval))
2094  _Pnode = this->_Right(_Pnode); // descend right subtree
2095  else
2096  { // _Pnode not less than _Keyval, remember it
2097  _Wherenode = _Pnode;
2098  _Pnode = this->_Left(_Pnode); // descend left subtree
2099  }
2100 
2101  return (_Wherenode); // return best remembered candidate
2102  }
#define _DEBUG_LT_PRED(pred, x, y)
Definition: xutility:462
const key_type & _Key(_Nodeptr _Pnode) const
Definition: xtree:2238
_Mybase::_Nodeptr _Nodeptr
Definition: xtree:1037
_Nodeptr & _Root() const
Definition: xtree:2151
template<class _Traits>
_Nodeptr _Tree< _Traits >::_Lbound ( const key_type _Keyval)
inlineprotected
2105  { // find leftmost node not less than _Keyval
2106  _Nodeptr _Pnode = _Root();
2107  _Nodeptr _Wherenode = this->_Myhead; // end() if search fails
2108 
2109  while (!this->_Isnil(_Pnode))
2110  if (_DEBUG_LT_PRED(this->_Getcomp(), this->_Key(_Pnode), _Keyval))
2111  _Pnode = this->_Right(_Pnode); // descend right subtree
2112  else
2113  { // _Pnode not less than _Keyval, remember it
2114  _Wherenode = _Pnode;
2115  _Pnode = this->_Left(_Pnode); // descend left subtree
2116  }
2117 
2118  return (_Wherenode); // return best remembered candidate
2119  }
#define _DEBUG_LT_PRED(pred, x, y)
Definition: xutility:462
const key_type & _Key(_Nodeptr _Pnode) const
Definition: xtree:2238
_Mybase::_Nodeptr _Nodeptr
Definition: xtree:1037
_Nodeptr & _Root() const
Definition: xtree:2151
template<class _Traits>
_Nodeptr& _Tree< _Traits >::_Lmost ( ) const
inlineprotected
2122  { // return leftmost node in nonmutable tree
2123  return (this->_Left(this->_Myhead));
2124  }
template<class _Traits>
void _Tree< _Traits >::_Lrotate ( _Nodeptr  _Wherenode)
inlineprotected
2127  { // promote right node to root of subtree
2128  _Nodeptr _Pnode = this->_Right(_Wherenode);
2129  this->_Right(_Wherenode) = this->_Left(_Pnode);
2130 
2131  if (!this->_Isnil(this->_Left(_Pnode)))
2132  this->_Parent(this->_Left(_Pnode)) = _Wherenode;
2133  this->_Parent(_Pnode) = this->_Parent(_Wherenode);
2134 
2135  if (_Wherenode == _Root())
2136  _Root() = _Pnode;
2137  else if (_Wherenode == this->_Left(this->_Parent(_Wherenode)))
2138  this->_Left(this->_Parent(_Wherenode)) = _Pnode;
2139  else
2140  this->_Right(this->_Parent(_Wherenode)) = _Pnode;
2141 
2142  this->_Left(_Pnode) = _Wherenode;
2143  this->_Parent(_Wherenode) = _Pnode;
2144  }
_Mybase::_Nodeptr _Nodeptr
Definition: xtree:1037
_Nodeptr & _Root() const
Definition: xtree:2151
template<class _Traits>
_Nodeptr& _Tree< _Traits >::_Rmost ( ) const
inlineprotected
2147  { // return rightmost node in nonmutable tree
2148  return (this->_Right(this->_Myhead));
2149  }
template<class _Traits>
_Nodeptr& _Tree< _Traits >::_Root ( ) const
inlineprotected
2152  { // return root of nonmutable tree
2153  return (this->_Parent(this->_Myhead));
2154  }
template<class _Traits>
void _Tree< _Traits >::_Rrotate ( _Nodeptr  _Wherenode)
inlineprotected
2157  { // promote left node to root of subtree
2158  _Nodeptr _Pnode = this->_Left(_Wherenode);
2159  this->_Left(_Wherenode) = this->_Right(_Pnode);
2160 
2161  if (!this->_Isnil(this->_Right(_Pnode)))
2162  this->_Parent(this->_Right(_Pnode)) = _Wherenode;
2163  this->_Parent(_Pnode) = this->_Parent(_Wherenode);
2164 
2165  if (_Wherenode == _Root())
2166  _Root() = _Pnode;
2167  else if (_Wherenode == this->_Right(this->_Parent(_Wherenode)))
2168  this->_Right(this->_Parent(_Wherenode)) = _Pnode;
2169  else
2170  this->_Left(this->_Parent(_Wherenode)) = _Pnode;
2171 
2172  this->_Right(_Pnode) = _Wherenode;
2173  this->_Parent(_Wherenode) = _Pnode;
2174  }
_Mybase::_Nodeptr _Nodeptr
Definition: xtree:1037
_Nodeptr & _Root() const
Definition: xtree:2151
template<class _Traits>
void _Tree< _Traits >::_Tidy ( )
inlineprotected
2229  { // free all storage
2230  erase(begin(), end());
2231  }
iterator end() _NOEXCEPT
Definition: xtree:1220
iterator erase(const_iterator _Where)
Definition: xtree:1327
iterator begin() _NOEXCEPT
Definition: xtree:1210
template<class _Traits>
_Nodeptr _Tree< _Traits >::_Ubound ( const key_type _Keyval) const
inlineprotected
2177  { // find leftmost node greater than _Keyval
2178  _Nodeptr _Pnode = _Root();
2179  _Nodeptr _Wherenode = this->_Myhead; // end() if search fails
2180 
2181  while (!this->_Isnil(_Pnode))
2182  if (_DEBUG_LT_PRED(this->_Getcomp(), _Keyval, this->_Key(_Pnode)))
2183  { // _Pnode greater than _Keyval, remember it
2184  _Wherenode = _Pnode;
2185  _Pnode = this->_Left(_Pnode); // descend left subtree
2186  }
2187  else
2188  _Pnode = this->_Right(_Pnode); // descend right subtree
2189 
2190  return (_Wherenode); // return best remembered candidate
2191  }
#define _DEBUG_LT_PRED(pred, x, y)
Definition: xutility:462
const key_type & _Key(_Nodeptr _Pnode) const
Definition: xtree:2238
_Mybase::_Nodeptr _Nodeptr
Definition: xtree:1037
_Nodeptr & _Root() const
Definition: xtree:2151
template<class _Traits>
_Nodeptr _Tree< _Traits >::_Ubound ( const key_type _Keyval)
inlineprotected
2194  { // find leftmost node greater than _Keyval
2195  _Nodeptr _Pnode = _Root();
2196  _Nodeptr _Wherenode = this->_Myhead; // end() if search fails
2197 
2198  while (!this->_Isnil(_Pnode))
2199  if (_DEBUG_LT_PRED(this->_Getcomp(), _Keyval, this->_Key(_Pnode)))
2200  { // _Pnode greater than _Keyval, remember it
2201  _Wherenode = _Pnode;
2202  _Pnode = this->_Left(_Pnode); // descend left subtree
2203  }
2204  else
2205  _Pnode = this->_Right(_Pnode); // descend right subtree
2206 
2207  return (_Wherenode); // return best remembered candidate
2208  }
#define _DEBUG_LT_PRED(pred, x, y)
Definition: xutility:462
const key_type & _Key(_Nodeptr _Pnode) const
Definition: xtree:2238
_Mybase::_Nodeptr _Nodeptr
Definition: xtree:1037
_Nodeptr & _Root() const
Definition: xtree:2151
template<class _Traits>
iterator _Tree< _Traits >::begin ( )
inline
1211  { // return iterator for beginning of mutable sequence
1212  return (iterator(_Lmost(), this));
1213  }
_Nodeptr & _Lmost() const
Definition: xtree:2121
_If< is_same< key_type, value_type >::value, typename _Mybase::const_iterator, typename _Mybase::iterator >::type iterator
Definition: xtree:1054
template<class _Traits>
const_iterator _Tree< _Traits >::begin ( ) const
inline
1216  { // return iterator for beginning of nonmutable sequence
1217  return (const_iterator(_Lmost(), this));
1218  }
_Nodeptr & _Lmost() const
Definition: xtree:2121
_Mybase::const_iterator const_iterator
Definition: xtree:1051
template<class _Traits>
const_iterator _Tree< _Traits >::cbegin ( ) const
inline
1251  { // return iterator for beginning of nonmutable sequence
1252  return (((const _Myt *)this)->begin());
1253  }
_Tree< _Traits > _Myt
Definition: xtree:1026
iterator begin() _NOEXCEPT
Definition: xtree:1210
template<class _Traits>
const_iterator _Tree< _Traits >::cend ( ) const
inline
1256  { // return iterator for end of nonmutable sequence
1257  return (((const _Myt *)this)->end());
1258  }
_Tree< _Traits > _Myt
Definition: xtree:1026
iterator end() _NOEXCEPT
Definition: xtree:1220
template<class _Traits>
void _Tree< _Traits >::clear ( )
inline
1535  { // erase all
1536  #if _ITERATOR_DEBUG_LEVEL == 2
1537  this->_Orphan_ptr(*this, 0);
1538  #endif /* _ITERATOR_DEBUG_LEVEL == 2 */
1539 
1540  _Erase(_Root());
1541  _Root() = this->_Myhead;
1542  _Lmost() = this->_Myhead;
1543  _Rmost() = this->_Myhead;
1544  this->_Mysize = 0;
1545  }
_Nodeptr & _Lmost() const
Definition: xtree:2121
_Nodeptr & _Rmost() const
Definition: xtree:2146
void _Erase(_Nodeptr _Rootnode)
Definition: xtree:2073
_Nodeptr & _Root() const
Definition: xtree:2151
template<class _Traits>
size_type _Tree< _Traits >::count ( const key_type _Keyval) const
inline
1566  { // count all elements that match _Keyval
1567  _Paircc _Ans = equal_range(_Keyval);
1568  size_type _Num = 0;
1569  _Distance(_Ans.first, _Ans.second, _Num);
1570  return (_Num);
1571  }
void _Distance(_InIt _First, _InIt _Last, _Diff &_Off)
Definition: xutility:764
_Pairii equal_range(const key_type &_Keyval)
Definition: xtree:1593
pair< const_iterator, const_iterator > _Paircc
Definition: xtree:1061
_Mybase::size_type size_type
Definition: xtree:1044
template<class _Traits>
const_reverse_iterator _Tree< _Traits >::crbegin ( ) const
inline
1261  { // return iterator for beginning of reversed nonmutable sequence
1262  return (((const _Myt *)this)->rbegin());
1263  }
_Tree< _Traits > _Myt
Definition: xtree:1026
reverse_iterator rbegin() _NOEXCEPT
Definition: xtree:1230
template<class _Traits>
const_reverse_iterator _Tree< _Traits >::crend ( ) const
inline
1266  { // return iterator for end of reversed nonmutable sequence
1267  return (((const _Myt *)this)->rend());
1268  }
reverse_iterator rend() _NOEXCEPT
Definition: xtree:1240
_Tree< _Traits > _Myt
Definition: xtree:1026
template<class _Traits>
template<class... _Valty>
_Pairib _Tree< _Traits >::emplace ( _Valty &&...  _Val)
inline
1175  { // try to insert value_type(_Val...), favoring right side
1176  _Nodeptr _Newnode = this->_Buynode(_STD forward<_Valty>(_Val)...);
1177  return (_Insert_nohint(false,
1178  this->_Myval(_Newnode), _Newnode));
1179  }
_Mybase::_Nodeptr _Nodeptr
Definition: xtree:1037
_Nodeptr _Buynode(_Valty &&..._Val)
Definition: xtree:923
_Pairib _Insert_nohint(bool _Leftish, _Valty &&_Val, _Nodety _Newnode)
Definition: xtree:1777
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Traits>
template<class... _Valty>
iterator _Tree< _Traits >::emplace_hint ( const_iterator  _Where,
_Valty &&...  _Val 
)
inline
1183  { // insert value_type(_Val...) at _Where
1184  _Nodeptr _Newnode = this->_Buynode(_STD forward<_Valty>(_Val)...);
1185  return (_Insert_hint(_Where,
1186  this->_Myval(_Newnode), _Newnode));
1187  }
iterator _Insert_hint(const_iterator _Where, _Valty &&_Val, _Nodety _Newnode)
Definition: xtree:1661
_Mybase::_Nodeptr _Nodeptr
Definition: xtree:1037
_Nodeptr _Buynode(_Valty &&..._Val)
Definition: xtree:923
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Traits>
bool _Tree< _Traits >::empty ( ) const
inline
1281  { // return true only if sequence is empty
1282  return (size() == 0);
1283  }
size_type size() const _NOEXCEPT
Definition: xtree:1270
template<class _Traits>
iterator _Tree< _Traits >::end ( )
inline
1221  { // return iterator for end of mutable sequence
1222  return (iterator(this->_Myhead, this));
1223  }
_If< is_same< key_type, value_type >::value, typename _Mybase::const_iterator, typename _Mybase::iterator >::type iterator
Definition: xtree:1054
template<class _Traits>
const_iterator _Tree< _Traits >::end ( ) const
inline
1226  { // return iterator for end of nonmutable sequence
1227  return (const_iterator(this->_Myhead, this));
1228  }
_Mybase::const_iterator const_iterator
Definition: xtree:1051
template<class _Traits>
_Pairii _Tree< _Traits >::equal_range ( const key_type _Keyval)
inline
1594  { // find range equivalent to _Keyval in mutable tree
1595  return (_Eqrange(_Keyval));
1596  }
_Paircc _Eqrange(const key_type &_Keyval) const
Definition: xtree:2003
template<class _Traits>
_Paircc _Tree< _Traits >::equal_range ( const key_type _Keyval) const
inline
1599  { // find range equivalent to _Keyval in nonmutable tree
1600  return (_Eqrange(_Keyval));
1601  }
_Paircc _Eqrange(const key_type &_Keyval) const
Definition: xtree:2003
template<class _Traits>
iterator _Tree< _Traits >::erase ( const_iterator  _Where)
inline
1328  { // erase element at _Where
1329  #if _ITERATOR_DEBUG_LEVEL == 2
1330  if (_Where._Getcont() != this || this->_Isnil(_Where._Mynode()))
1331  _DEBUG_ERROR("map/set erase iterator outside range");
1332  _Nodeptr _Erasednode = _Where._Mynode(); // node to erase
1333  ++_Where; // save successor iterator for return
1334  _Orphan_ptr(*this, _Erasednode);
1335 
1336  #else /* _ITERATOR_DEBUG_LEVEL == 2 */
1337  _Nodeptr _Erasednode = _Where._Mynode(); // node to erase
1338  ++_Where; // save successor iterator for return
1339  #endif /* _ITERATOR_DEBUG_LEVEL == 2 */
1340 
1341  _Nodeptr _Fixnode; // the node to recolor as needed
1342  _Nodeptr _Fixnodeparent; // parent of _Fixnode (which may be nil)
1343  _Nodeptr _Pnode = _Erasednode;
1344 
1345  if (this->_Isnil(this->_Left(_Pnode)))
1346  _Fixnode = this->_Right(_Pnode); // stitch up right subtree
1347  else if (this->_Isnil(this->_Right(_Pnode)))
1348  _Fixnode = this->_Left(_Pnode); // stitch up left subtree
1349  else
1350  { // two subtrees, must lift successor node to replace erased
1351  _Pnode = _Where._Mynode(); // _Pnode is successor node
1352  _Fixnode = this->_Right(_Pnode); // _Fixnode is only subtree
1353  }
1354 
1355  if (_Pnode == _Erasednode)
1356  { // at most one subtree, relink it
1357  _Fixnodeparent = this->_Parent(_Erasednode);
1358  if (!this->_Isnil(_Fixnode))
1359  this->_Parent(_Fixnode) = _Fixnodeparent; // link up
1360 
1361  if (_Root() == _Erasednode)
1362  _Root() = _Fixnode; // link down from root
1363  else if (this->_Left(_Fixnodeparent) == _Erasednode)
1364  this->_Left(_Fixnodeparent) = _Fixnode; // link down to left
1365  else
1366  this->_Right(_Fixnodeparent) =
1367  _Fixnode; // link down to right
1368 
1369  if (_Lmost() == _Erasednode)
1370  _Lmost() = this->_Isnil(_Fixnode)
1371  ? _Fixnodeparent // smallest is parent of erased node
1372  : this->_Min(_Fixnode); // smallest in relinked subtree
1373 
1374  if (_Rmost() == _Erasednode)
1375  _Rmost() = this->_Isnil(_Fixnode)
1376  ? _Fixnodeparent // largest is parent of erased node
1377  : this->_Max(_Fixnode); // largest in relinked subtree
1378  }
1379  else
1380  { // erased has two subtrees, _Pnode is successor to erased
1381  this->_Parent(this->_Left(_Erasednode)) =
1382  _Pnode; // link left up
1383  this->_Left(_Pnode) =
1384  this->_Left(_Erasednode); // link successor down
1385 
1386  if (_Pnode == this->_Right(_Erasednode))
1387  _Fixnodeparent = _Pnode; // successor is next to erased
1388  else
1389  { // successor further down, link in place of erased
1390  _Fixnodeparent =
1391  this->_Parent(_Pnode); // parent is successor's
1392  if (!this->_Isnil(_Fixnode))
1393  this->_Parent(_Fixnode) = _Fixnodeparent; // link fix up
1394  this->_Left(_Fixnodeparent) = _Fixnode; // link fix down
1395  this->_Right(_Pnode) =
1396  this->_Right(_Erasednode); // link next down
1397  this->_Parent(this->_Right(_Erasednode)) =
1398  _Pnode; // right up
1399  }
1400 
1401  if (_Root() == _Erasednode)
1402  _Root() = _Pnode; // link down from root
1403  else if (this->_Left(this->_Parent(_Erasednode)) == _Erasednode)
1404  this->_Left(this->_Parent(_Erasednode)) =
1405  _Pnode; // link down to left
1406  else
1407  this->_Right(this->_Parent(_Erasednode)) =
1408  _Pnode; // link down to right
1409 
1410  this->_Parent(_Pnode) =
1411  this->_Parent(_Erasednode); // link successor up
1412  _STD swap(this->_Color(_Pnode),
1413  this->_Color(_Erasednode)); // recolor it
1414  }
1415 
1416  if (this->_Color(_Erasednode) == this->_Black)
1417  { // erasing black link, must recolor/rebalance tree
1418  for (; _Fixnode != _Root()
1419  && this->_Color(_Fixnode) == this->_Black;
1420  _Fixnodeparent = this->_Parent(_Fixnode))
1421  if (_Fixnode == this->_Left(_Fixnodeparent))
1422  { // fixup left subtree
1423  _Pnode = this->_Right(_Fixnodeparent);
1424  if (this->_Color(_Pnode) == this->_Red)
1425  { // rotate red up from right subtree
1426  this->_Color(_Pnode) = this->_Black;
1427  this->_Color(_Fixnodeparent) = this->_Red;
1428  _Lrotate(_Fixnodeparent);
1429  _Pnode = this->_Right(_Fixnodeparent);
1430  }
1431 
1432  if (this->_Isnil(_Pnode))
1433  _Fixnode = _Fixnodeparent; // shouldn't happen
1434  else if (this->_Color(this->_Left(_Pnode)) == this->_Black
1435  && this->_Color(this->_Right(_Pnode)) == this->_Black)
1436  { // redden right subtree with black children
1437  this->_Color(_Pnode) = this->_Red;
1438  _Fixnode = _Fixnodeparent;
1439  }
1440  else
1441  { // must rearrange right subtree
1442  if (this->_Color(this->_Right(_Pnode))
1443  == this->_Black)
1444  { // rotate red up from left sub-subtree
1445  this->_Color(this->_Left(_Pnode)) = this->_Black;
1446  this->_Color(_Pnode) = this->_Red;
1447  _Rrotate(_Pnode);
1448  _Pnode = this->_Right(_Fixnodeparent);
1449  }
1450 
1451  this->_Color(_Pnode) = this->_Color(_Fixnodeparent);
1452  this->_Color(_Fixnodeparent) = this->_Black;
1453  this->_Color(this->_Right(_Pnode)) = this->_Black;
1454  _Lrotate(_Fixnodeparent);
1455  break; // tree now recolored/rebalanced
1456  }
1457  }
1458  else
1459  { // fixup right subtree
1460  _Pnode = this->_Left(_Fixnodeparent);
1461  if (this->_Color(_Pnode) == this->_Red)
1462  { // rotate red up from left subtree
1463  this->_Color(_Pnode) = this->_Black;
1464  this->_Color(_Fixnodeparent) = this->_Red;
1465  _Rrotate(_Fixnodeparent);
1466  _Pnode = this->_Left(_Fixnodeparent);
1467  }
1468 
1469  if (this->_Isnil(_Pnode))
1470  _Fixnode = _Fixnodeparent; // shouldn't happen
1471  else if (this->_Color(this->_Right(_Pnode)) ==
1472  this->_Black
1473  && this->_Color(this->_Left(_Pnode)) == this->_Black)
1474  { // redden left subtree with black children
1475  this->_Color(_Pnode) = this->_Red;
1476  _Fixnode = _Fixnodeparent;
1477  }
1478  else
1479  { // must rearrange left subtree
1480  if (this->_Color(this->_Left(_Pnode)) == this->_Black)
1481  { // rotate red up from right sub-subtree
1482  this->_Color(this->_Right(_Pnode)) = this->_Black;
1483  this->_Color(_Pnode) = this->_Red;
1484  _Lrotate(_Pnode);
1485  _Pnode = this->_Left(_Fixnodeparent);
1486  }
1487 
1488  this->_Color(_Pnode) = this->_Color(_Fixnodeparent);
1489  this->_Color(_Fixnodeparent) = this->_Black;
1490  this->_Color(this->_Left(_Pnode)) = this->_Black;
1491  _Rrotate(_Fixnodeparent);
1492  break; // tree now recolored/rebalanced
1493  }
1494  }
1495 
1496  this->_Color(_Fixnode) = this->_Black; // stopping node is black
1497  }
1498 
1499  this->_Getal().destroy(
1500  _STD addressof(this->_Myval(_Erasednode))); // delete erased node
1501 
1502  this->_Getal().deallocate(_Erasednode, 1);
1503 
1504  if (0 < this->_Mysize)
1505  --this->_Mysize;
1506 
1507  return (iterator(_Where._Ptr, this)); // return successor iterator
1508  }
void _Lrotate(_Nodeptr _Wherenode)
Definition: xtree:2126
_Nodeptr & _Lmost() const
Definition: xtree:2121
_Nodeptr & _Rmost() const
Definition: xtree:2146
void swap(_Myt &_Right)
Definition: xtree:1603
void _Rrotate(_Nodeptr _Wherenode)
Definition: xtree:2156
_If< is_same< key_type, value_type >::value, typename _Mybase::const_iterator, typename _Mybase::iterator >::type iterator
Definition: xtree:1054
_Mybase::_Nodeptr _Nodeptr
Definition: xtree:1037
_Nodeptr & _Root() const
Definition: xtree:2151
_Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:91
#define _DEBUG_ERROR(mesg)
Definition: xutility:32
template<class _Traits>
iterator _Tree< _Traits >::erase ( const_iterator  _First,
const_iterator  _Last 
)
inline
1511  { // erase [_First, _Last)
1512  if (_First == begin() && _Last == end())
1513  { // erase all
1514  clear();
1515  return (begin());
1516  }
1517  else
1518  { // partial erase, one at a time
1519  while (_First != _Last)
1520  erase(_First++);
1521  return (iterator(_First._Ptr, this));
1522  }
1523  }
iterator end() _NOEXCEPT
Definition: xtree:1220
_If< is_same< key_type, value_type >::value, typename _Mybase::const_iterator, typename _Mybase::iterator >::type iterator
Definition: xtree:1054
void clear() _NOEXCEPT
Definition: xtree:1534
iterator erase(const_iterator _Where)
Definition: xtree:1327
iterator begin() _NOEXCEPT
Definition: xtree:1210
_FwdIt _Last
Definition: algorithm:1936
template<class _Traits>
size_type _Tree< _Traits >::erase ( const key_type _Keyval)
inline
1526  { // erase and count all that match _Keyval
1527  _Pairii _Where = equal_range(_Keyval);
1528  size_type _Num = 0;
1529  _Distance(_Where.first, _Where.second, _Num);
1530  erase(_Where.first, _Where.second);
1531  return (_Num);
1532  }
void _Distance(_InIt _First, _InIt _Last, _Diff &_Off)
Definition: xutility:764
_Pairii equal_range(const key_type &_Keyval)
Definition: xtree:1593
iterator erase(const_iterator _Where)
Definition: xtree:1327
pair< iterator, iterator > _Pairii
Definition: xtree:1060
_Mybase::size_type size_type
Definition: xtree:1044
template<class _Traits>
iterator _Tree< _Traits >::find ( const key_type _Keyval)
inline
1548  { // find an element in mutable sequence that matches _Keyval
1549  iterator _Where = lower_bound(_Keyval);
1550  return (_Where == end()
1551  || _DEBUG_LT_PRED(this->_Getcomp(),
1552  _Keyval, this->_Key(_Where._Mynode()))
1553  ? end() : _Where);
1554  }
iterator lower_bound(const key_type &_Keyval)
Definition: xtree:1573
#define _DEBUG_LT_PRED(pred, x, y)
Definition: xutility:462
Definition: xutility:337
iterator end() _NOEXCEPT
Definition: xtree:1220
const key_type & _Key(_Nodeptr _Pnode) const
Definition: xtree:2238
template<class _Traits>
const_iterator _Tree< _Traits >::find ( const key_type _Keyval) const
inline
1557  { // find an element in nonmutable sequence that matches _Keyval
1558  const_iterator _Where = lower_bound(_Keyval);
1559  return (_Where == end()
1560  || _DEBUG_LT_PRED(this->_Getcomp(),
1561  _Keyval, this->_Key(_Where._Mynode()))
1562  ? end() : _Where);
1563  }
iterator lower_bound(const key_type &_Keyval)
Definition: xtree:1573
#define _DEBUG_LT_PRED(pred, x, y)
Definition: xutility:462
_Mybase::const_iterator const_iterator
Definition: xtree:1051
iterator end() _NOEXCEPT
Definition: xtree:1220
const key_type & _Key(_Nodeptr _Pnode) const
Definition: xtree:2238
template<class _Traits>
allocator_type _Tree< _Traits >::get_allocator ( ) const
inline
1286  { // return allocator object for values
1287  return (this->_Getal());
1288  }
template<class _Traits>
_Pairib _Tree< _Traits >::insert ( value_type &&  _Val)
inline
1142  { // try to insert node with value _Val, favoring right side
1143  return (_Insert_nohint(false,
1144  _STD forward<value_type>(_Val), _Nil_obj));
1145  }
static _Nil _Nil_obj
Definition: xtr1common:29
_Pairib _Insert_nohint(bool _Leftish, _Valty &&_Val, _Nodety _Newnode)
Definition: xtree:1777
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Traits>
iterator _Tree< _Traits >::insert ( const_iterator  _Where,
value_type &&  _Val 
)
inline
1148  { // try to insert node with value _Val using _Where as a hint
1149  return (_Insert_hint(_Where,
1150  _STD forward<value_type>(_Val), _Nil_obj));
1151  }
iterator _Insert_hint(const_iterator _Where, _Valty &&_Val, _Nodety _Newnode)
Definition: xtree:1661
static _Nil _Nil_obj
Definition: xtr1common:29
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Traits>
template<class _Valty >
enable_if<is_convertible<_Valty, value_type>::value, _Pairib>::type _Tree< _Traits >::insert ( _Valty &&  _Val)
inline
1157  { // try to insert node with value _Val, favoring right side
1158  _Nodeptr _Newnode = this->_Buynode(_STD forward<_Valty>(_Val));
1159  return (_Insert_nohint(false,
1160  this->_Myval(_Newnode), _Newnode));
1161  }
_Mybase::_Nodeptr _Nodeptr
Definition: xtree:1037
_Nodeptr _Buynode(_Valty &&..._Val)
Definition: xtree:923
_Pairib _Insert_nohint(bool _Leftish, _Valty &&_Val, _Nodety _Newnode)
Definition: xtree:1777
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Traits>
template<class _Valty >
enable_if<is_convertible<_Valty, value_type>::value, iterator>::type _Tree< _Traits >::insert ( const_iterator  _Where,
_Valty &&  _Val 
)
inline
1167  { // try to insert node with value _Val using _Where as a hint
1168  _Nodeptr _Newnode = this->_Buynode(_STD forward<_Valty>(_Val));
1169  return (_Insert_hint(_Where,
1170  this->_Myval(_Newnode), _Newnode));
1171  }
iterator _Insert_hint(const_iterator _Where, _Valty &&_Val, _Nodety _Newnode)
Definition: xtree:1661
_Mybase::_Nodeptr _Nodeptr
Definition: xtree:1037
_Nodeptr _Buynode(_Valty &&..._Val)
Definition: xtree:923
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Traits>
_Pairib _Tree< _Traits >::insert ( const value_type _Val)
inline
1301  { // try to insert node with value _Val, favoring right side
1302  return (_Insert_nohint(false,
1303  _Val, _Nil_obj));
1304  }
static _Nil _Nil_obj
Definition: xtr1common:29
_Pairib _Insert_nohint(bool _Leftish, _Valty &&_Val, _Nodety _Newnode)
Definition: xtree:1777
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Traits>
iterator _Tree< _Traits >::insert ( const_iterator  _Where,
const value_type _Val 
)
inline
1308  { // try to insert node with value _Val using _Where as a hint
1309  return (_Insert_hint(_Where,
1310  _Val, _Nil_obj));
1311  }
iterator _Insert_hint(const_iterator _Where, _Valty &&_Val, _Nodety _Newnode)
Definition: xtree:1661
static _Nil _Nil_obj
Definition: xtr1common:29
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Traits>
template<class _Iter >
void _Tree< _Traits >::insert ( _Iter  _First,
_Iter  _Last 
)
inline
1315  { // insert [_First, _Last) one at a time
1316  _DEBUG_RANGE(_First, _Last);
1317  for (; _First != _Last; ++_First)
1318 
1319  emplace_hint(end(), *_First);
1320  }
iterator emplace_hint(const_iterator _Where, _Valty &&..._Val)
Definition: xtree:1182
#define _DEBUG_RANGE(first, last)
Definition: xutility:467
iterator end() _NOEXCEPT
Definition: xtree:1220
_FwdIt _Last
Definition: algorithm:1936
template<class _Traits>
void _Tree< _Traits >::insert ( _XSTD initializer_list< value_type _Ilist)
inline
1323  { // insert initializer_list
1324  insert(_Ilist.begin(), _Ilist.end());
1325  }
_Pairib insert(value_type &&_Val)
Definition: xtree:1141
template<class _Traits>
key_compare _Tree< _Traits >::key_comp ( ) const
inline
1291  { // return object for comparing keys
1292  return (this->_Getcomp());
1293  }
template<class _Traits>
iterator _Tree< _Traits >::lower_bound ( const key_type _Keyval)
inline
1574  { // find leftmost node not less than _Keyval in mutable tree
1575  return (iterator(_Lbound(_Keyval), this));
1576  }
_If< is_same< key_type, value_type >::value, typename _Mybase::const_iterator, typename _Mybase::iterator >::type iterator
Definition: xtree:1054
_Nodeptr _Lbound(const key_type &_Keyval) const
Definition: xtree:2087
template<class _Traits>
const_iterator _Tree< _Traits >::lower_bound ( const key_type _Keyval) const
inline
1579  { // find leftmost node not less than _Keyval in nonmutable tree
1580  return (const_iterator(_Lbound(_Keyval), this));
1581  }
_Mybase::const_iterator const_iterator
Definition: xtree:1051
_Nodeptr _Lbound(const key_type &_Keyval) const
Definition: xtree:2087
template<class _Traits>
size_type _Tree< _Traits >::max_size ( ) const
inline
1276  { // return maximum possible length of sequence
1277  return (this->_Getal().max_size());
1278  }
size_type max_size() const _NOEXCEPT
Definition: xtree:1275
template<class _Traits>
_Myt& _Tree< _Traits >::operator= ( _Myt &&  _Right)
inline
1105  { // assign by moving _Right
1106  if (this != &_Right)
1107  { // different, move it
1108  clear();
1109  if (_Alty::propagate_on_container_move_assignment::value
1110  && this->_Getal() != _Right._Getal())
1111  this->_Change_alloc(_Right._Getal());
1112 
1113  _Assign_rv(_STD forward<_Myt>(_Right));
1114  }
1115  return (*this);
1116  }
void _Assign_rv(_Myt &&_Right, true_type)
Definition: xtree:1118
void clear() _NOEXCEPT
Definition: xtree:1534
template<class _Traits>
_Myt& _Tree< _Traits >::operator= ( const _Myt _Right)
inline
1196  { // replace contents from _Right
1197  if (this != &_Right)
1198  { // different, assign it
1199  clear();
1200  if (this->_Getal() != _Right._Getal()
1201  && _Alty::propagate_on_container_copy_assignment::value)
1202  this->_Change_alloc(_Right._Getal());
1203 
1204  this->_Setcomp(_Right._Getcomp());
1205  _Copy(_Right, false_type());
1206  }
1207  return (*this);
1208  }
void _Setcomp(const key_compare &_Right)
Definition: xtree:974
integral_constant< bool, false > false_type
Definition: xtr1common:48
void clear() _NOEXCEPT
Definition: xtree:1534
void _Copy(const _Myt &_Right, _Moveit _Movefl)
Definition: xtree:1927
template<class _Traits>
reverse_iterator _Tree< _Traits >::rbegin ( )
inline
1231  { // return iterator for beginning of reversed mutable sequence
1232  return (reverse_iterator(end()));
1233  }
iterator end() _NOEXCEPT
Definition: xtree:1220
_STD reverse_iterator< iterator > reverse_iterator
Definition: xtree:1056
template<class _Traits>
const_reverse_iterator _Tree< _Traits >::rbegin ( ) const
inline
1236  { // return iterator for beginning of reversed nonmutable sequence
1237  return (const_reverse_iterator(end()));
1238  }
iterator end() _NOEXCEPT
Definition: xtree:1220
_STD reverse_iterator< const_iterator > const_reverse_iterator
Definition: xtree:1057
template<class _Traits>
reverse_iterator _Tree< _Traits >::rend ( )
inline
1241  { // return iterator for end of reversed mutable sequence
1242  return (reverse_iterator(begin()));
1243  }
iterator begin() _NOEXCEPT
Definition: xtree:1210
_STD reverse_iterator< iterator > reverse_iterator
Definition: xtree:1056
template<class _Traits>
const_reverse_iterator _Tree< _Traits >::rend ( ) const
inline
1246  { // return iterator for end of reversed nonmutable sequence
1247  return (const_reverse_iterator(begin()));
1248  }
iterator begin() _NOEXCEPT
Definition: xtree:1210
_STD reverse_iterator< const_iterator > const_reverse_iterator
Definition: xtree:1057
template<class _Traits>
size_type _Tree< _Traits >::size ( ) const
inline
1271  { // return length of sequence
1272  return (this->_Mysize);
1273  }
template<class _Traits>
void _Tree< _Traits >::swap ( _Myt _Right)
inline
1604  { // exchange contents with _Right
1605  if (this == &_Right)
1606  ; // same object, do nothing
1607  else if (this->_Getal() == _Right._Getal())
1608  { // same allocator, swap control information
1609  this->_Swap_all(_Right);
1610  this->_Swapcomp(_Right._Getcomp());
1611  _Swap_adl(this->_Myhead, _Right._Myhead);
1612  _STD swap(this->_Mysize, _Right._Mysize);
1613  }
1614 
1615  else if (_Alty::propagate_on_container_swap::value)
1616  { // swap allocators and control information
1617  this->_Swap_alloc(_Right);
1618  this->_Swapcomp(_Right._Getcomp());
1619  _Swap_adl(this->_Myhead, _Right._Myhead);
1620  _STD swap(this->_Mysize, _Right._Mysize);
1621  }
1622 
1623  else
1624  { // containers are incompatible
1625  #if _ITERATOR_DEBUG_LEVEL == 2
1626  _DEBUG_ERROR("map/set containers incompatible for swap");
1627 
1628  #else /* ITERATOR_DEBUG_LEVEL == 2 */
1629  _XSTD terminate();
1630  #endif /* ITERATOR_DEBUG_LEVEL == 2 */
1631  }
1632  }
void __CRTDECL terminate()
Definition: exception:303
void swap(_Myt &_Right)
Definition: xtree:1603
void _Swapcomp(key_compare &_Right)
Definition: xtree:979
void _Swap_all(_Container_base0 &)
Definition: xutility:46
#define _XSTD
Definition: xstddef:20
#define _DEBUG_ERROR(mesg)
Definition: xutility:32
template<class _Traits>
iterator _Tree< _Traits >::upper_bound ( const key_type _Keyval)
inline
1584  { // find leftmost node greater than _Keyval in mutable tree
1585  return (iterator(_Ubound(_Keyval), this));
1586  }
_If< is_same< key_type, value_type >::value, typename _Mybase::const_iterator, typename _Mybase::iterator >::type iterator
Definition: xtree:1054
_Nodeptr _Ubound(const key_type &_Keyval) const
Definition: xtree:2176
template<class _Traits>
const_iterator _Tree< _Traits >::upper_bound ( const key_type _Keyval) const
inline
1589  { // find leftmost node greater than _Keyval in nonmutable tree
1590  return (const_iterator(_Ubound(_Keyval), this));
1591  }
_Mybase::const_iterator const_iterator
Definition: xtree:1051
_Nodeptr _Ubound(const key_type &_Keyval) const
Definition: xtree:2176
template<class _Traits>
value_compare _Tree< _Traits >::value_comp ( ) const
inline
1296  { // return object for comparing values
1297  return (value_compare(key_comp()));
1298  }
_Traits::value_compare value_compare
Definition: xtree:1031
key_compare key_comp() const
Definition: xtree:1290

The documentation for this class was generated from the following file: