STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
_Tree< _Traits > Class Template Reference
Inheritance diagram for _Tree< _Traits >:
_Tree_comp_alloc< _Traits >

Classes

struct  _Copy_tag
 
struct  _Move_tag
 

Public Types

enum  { _Multi = _Traits::_Multi }
 
typedef _Tree< _Traits > _Myt
 
typedef _Tree_comp_alloc< _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_alloc< _Traits >
enum  _Redbl { _Red, _Black }
 
typedef _Tree_comp_alloc< _Traits > _Myt
 
typedef _Traits::allocator_type allocator_type
 
typedef _Traits::key_compare key_compare
 
typedef _Tree_base_types< typename _Traits::value_type, allocator_type_Alloc_types
 
typedef _Alloc_types::_Alloc _Alloc
 
typedef _Alloc_types::_Alnod_type _Alty
 
typedef _Alloc_types::_Node _Node
 
typedef _Alloc_types::_Nodeptr _Nodeptr
 
typedef _Alloc_types::_Val_types _Val_types
 
typedef _Nodeptr_Nodepref
 
typedef _Val_types::value_type value_type
 
typedef _Val_types::size_type size_type
 
typedef _Val_types::difference_type difference_type
 
typedef _Val_types::pointer pointer
 
typedef _Val_types::const_pointer const_pointer
 
typedef _Val_types::reference reference
 
typedef _Val_types::const_reference const_reference
 
typedef _Tree_const_iterator< _Tree_val< _Val_types > > const_iterator
 
typedef _Tree_iterator< _Tree_val< _Val_types > > iterator
 

Public Member Functions

 _Tree (const key_compare &_Parg)
 
 _Tree (const key_compare &_Parg, const allocator_type &_Al)
 
template<class _Any_alloc >
 _Tree (const _Myt &_Right, _Any_alloc &&_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)
 
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
 
template<bool _Multi2 = _Multi, enable_if_t<!_Multi2, int > = 0>
_Pairib insert (const value_type &_Val)
 
template<bool _Multi2 = _Multi, enable_if_t< _Multi2, int > = 0>
iterator insert (const value_type &_Val)
 
template<bool _Multi2 = _Multi, enable_if_t<!_Multi2, int > = 0>
_Pairib insert (value_type &&_Val)
 
template<bool _Multi2 = _Multi, enable_if_t< _Multi2, int > = 0>
iterator insert (value_type &&_Val)
 
iterator insert (const_iterator _Where, const value_type &_Val)
 
iterator insert (const_iterator _Where, 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
 
template<class _Other , class _Mycomp = key_compare, class = typename _Mycomp::is_transparent>
iterator find (const _Other &_Keyval)
 
template<class _Other , class _Mycomp = key_compare, class = typename _Mycomp::is_transparent>
const_iterator find (const _Other &_Keyval) const
 
size_type count (const key_type &_Keyval) const
 
template<class _Other , class _Mycomp = key_compare, class = typename _Mycomp::is_transparent>
size_type count (const _Other &_Keyval) const
 
iterator lower_bound (const key_type &_Keyval)
 
const_iterator lower_bound (const key_type &_Keyval) const
 
template<class _Other , class _Mycomp = key_compare, class = typename _Mycomp::is_transparent>
iterator lower_bound (const _Other &_Keyval)
 
template<class _Other , class _Mycomp = key_compare, class = typename _Mycomp::is_transparent>
const_iterator lower_bound (const _Other &_Keyval) const
 
iterator upper_bound (const key_type &_Keyval)
 
const_iterator upper_bound (const key_type &_Keyval) const
 
template<class _Other , class _Mycomp = key_compare, class = typename _Mycomp::is_transparent>
iterator upper_bound (const _Other &_Keyval)
 
template<class _Other , class _Mycomp = key_compare, class = typename _Mycomp::is_transparent>
const_iterator upper_bound (const _Other &_Keyval) const
 
_Pairii equal_range (const key_type &_Keyval)
 
_Paircc equal_range (const key_type &_Keyval) const
 
template<class _Other , class _Mycomp = key_compare, class = typename _Mycomp::is_transparent>
_Pairii equal_range (const _Other &_Keyval)
 
template<class _Other , class _Mycomp = key_compare, class = typename _Mycomp::is_transparent>
_Paircc equal_range (const _Other &_Keyval) const
 
void swap (_Myt &_Right)
 
- Public Member Functions inherited from _Tree_comp_alloc< _Traits >
 _Tree_comp_alloc (const key_compare &_Parg)
 
template<class _Any_alloc , class = enable_if_t<!is_same<decay_t<_Any_alloc>, _Myt>::value>>
 _Tree_comp_alloc (const key_compare &_Parg, _Any_alloc &&_Al)
 
void _Construct ()
 
 ~_Tree_comp_alloc () _NOEXCEPT
 
void _Copy_alloc (const _Alty &_Al)
 
void _Move_alloc (_Alty &_Al)
 
void _Orphan_all ()
 
void _Swap_all (_Myt &_Right)
 
_Nodeptr _Buyheadnode ()
 
void _Freeheadnode (_Nodeptr _Pnode)
 
_Nodeptr _Buynode0 ()
 
void _Freenode0 (_Nodeptr _Pnode)
 
template<class... _Valty>
_Nodeptr _Buynode (_Valty &&..._Val)
 
key_compare_Getcomp () _NOEXCEPT
 
const key_compare_Getcomp () const _NOEXCEPT
 
_Alty_Getal () _NOEXCEPT
 
const _Alty_Getal () const _NOEXCEPT
 
_Tree_val< _Val_types > & _Get_data () _NOEXCEPT
 
const _Tree_val< _Val_types > & _Get_data () const _NOEXCEPT
 
_Nodeptr_Myhead () _NOEXCEPT
 
const _Nodeptr_Myhead () const _NOEXCEPT
 
size_type_Mysize () _NOEXCEPT
 
const size_type_Mysize () const _NOEXCEPT
 

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 _Ty , class _Is_set >
_Nodeptr _Copy_or_move (_Ty &_Val, _Copy_tag, _Is_set)
 
template<class _Ty >
_Nodeptr _Copy_or_move (_Ty &_Val, _Move_tag, true_type)
 
template<class _Ty >
_Nodeptr _Copy_or_move (_Ty &_Val, _Move_tag, false_type)
 
template<class _Moveit >
_Nodeptr _Copy_nodes (_Nodeptr _Rootnode, _Nodeptr _Wherenode, _Moveit _Movefl)
 
template<class _Other >
_Paircc _Eqrange (const _Other &_Keyval) const
 
template<class _Other >
_Pairii _Eqrange (const _Other &_Keyval)
 
void _Erase (_Nodeptr _Rootnode)
 
bool _Compare (const key_type &_Left, const key_type &_Right) const
 
template<class _Ty1 , class _Ty2 >
bool _Compare (const _Ty1 &_Left, const _Ty2 &_Right) const
 
template<class _Other >
_Nodeptr _Lbound (const _Other &_Keyval) const
 
_Nodeptr_Lmost () const
 
void _Lrotate (_Nodeptr _Wherenode)
 
_Nodeptr_Rmost () const
 
_Nodeptr_Root () const
 
void _Rrotate (_Nodeptr _Wherenode)
 
template<class _Other >
_Nodeptr _Ubound (const _Other &_Keyval) const
 
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_comp_alloc< _Traits >
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)
 

Member Typedef Documentation

template<class _Traits>
typedef _Mybase::_Alty _Tree< _Traits >::_Alty
template<class _Traits>
typedef _Tree_comp_alloc<_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 
965  { // get multi parameter
966  _Multi = _Traits::_Multi};
Definition: xtree:966

Constructor & Destructor Documentation

template<class _Traits>
_Tree< _Traits >::_Tree ( const key_compare _Parg)
inline
1003  : _Mybase(_Parg)
1004  { // construct empty tree from comparator
1005  }
_Tree_comp_alloc< _Traits > _Mybase
Definition: xtree:960
template<class _Traits>
_Tree< _Traits >::_Tree ( const key_compare _Parg,
const allocator_type _Al 
)
inline
1009  : _Mybase(_Parg, _Al)
1010  { // construct empty tree from comparator, allocator
1011  }
_Tree_comp_alloc< _Traits > _Mybase
Definition: xtree:960
template<class _Traits>
template<class _Any_alloc >
_Tree< _Traits >::_Tree ( const _Myt _Right,
_Any_alloc &&  _Al 
)
inline
1015  : _Mybase(_Right.key_comp(), _STD forward<_Any_alloc>(_Al))
1016  { // construct tree by copying _Right, allocator
1017  _TRY_BEGIN
1018  _Copy(_Right, _Copy_tag());
1019  _CATCH_ALL
1020  _Tidy();
1021  _RERAISE;
1022  _CATCH_END
1023  }
static _Nodepref _Right(_Nodeptr _Pnode)
Definition: xtree:681
#define _TRY_BEGIN
Definition: xstddef:60
#define _CATCH_END
Definition: xstddef:63
_Tree_comp_alloc< _Traits > _Mybase
Definition: xtree:960
#define _CATCH_ALL
Definition: xstddef:62
void _Copy(const _Myt &_Right, _Moveit _Movefl)
Definition: xtree:1919
void _Tidy()
Definition: xtree:2166
#define _RERAISE
Definition: xstddef:74
template<class _Traits>
_Tree< _Traits >::_Tree ( _Myt &&  _Right)
inline
1026  : _Mybase(_Right.key_comp(), _STD move(_Right._Getal()))
1027  { // construct tree by moving _Right
1028  _Assign_rv(_STD forward<_Myt>(_Right), true_type());
1029  }
void _Assign_rv(_Myt &&_Right, true_type)
Definition: xtree:1051
static _Nodepref _Right(_Nodeptr _Pnode)
Definition: xtree:681
_Tree_comp_alloc< _Traits > _Mybase
Definition: xtree:960
integral_constant< bool, true > true_type
Definition: xtr1common:40
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1290
template<class _Traits>
_Tree< _Traits >::_Tree ( _Myt &&  _Right,
const allocator_type _Al 
)
inline
1032  : _Mybase(_Right.key_comp(), _Al)
1033  { // construct tree by moving _Right, allocator
1034  _Assign_rv(_STD forward<_Myt>(_Right));
1035  }
void _Assign_rv(_Myt &&_Right, true_type)
Definition: xtree:1051
static _Nodepref _Right(_Nodeptr _Pnode)
Definition: xtree:681
_Tree_comp_alloc< _Traits > _Mybase
Definition: xtree:960
template<class _Traits>
_Tree< _Traits >::~_Tree ( )
inline
1090  { // destroy tree
1091  _Tidy();
1092  }
void _Tidy()
Definition: xtree:2166

Member Function Documentation

template<class _Traits>
void _Tree< _Traits >::_Assign_rv ( _Myt &&  _Right,
true_type   
)
inline
1052  { // move from _Right, stealing its contents
1053  this->_Swap_all(_Right);
1054  _Swap_adl(this->_Getcomp(), _Right._Getcomp());
1055  _Swap_adl(this->_Myhead(), _Right._Myhead());
1056  _STD swap(this->_Mysize(), _Right._Mysize());
1057  }
void _Swap_all(_Myt &_Right)
Definition: xtree:811
key_compare & _Getcomp() _NOEXCEPT
Definition: xtree:898
_Nodeptr & _Myhead() _NOEXCEPT
Definition: xtree:928
static _Nodepref _Right(_Nodeptr _Pnode)
Definition: xtree:681
size_type & _Mysize() _NOEXCEPT
Definition: xtree:938
void swap(_Myt &_Right)
Definition: xtree:1614
void _Swap_adl(_Ty &_Left, _Ty &_Right) _NOEXCEPT_OP(_Is_nothrow_swappable< _Ty >
Definition: utility:56
template<class _Traits>
void _Tree< _Traits >::_Assign_rv ( _Myt &&  _Right,
false_type   
)
inline
1060  { // move from _Right, possibly moving its contents
1061  if (get_allocator() == _Right.get_allocator())
1062  _Assign_rv(_STD forward<_Myt>(_Right), true_type());
1063  else
1064  _Copy(_Right, _Move_tag());
1065  }
void _Assign_rv(_Myt &&_Right, true_type)
Definition: xtree:1051
static _Nodepref _Right(_Nodeptr _Pnode)
Definition: xtree:681
void _Copy(const _Myt &_Right, _Moveit _Movefl)
Definition: xtree:1919
allocator_type get_allocator() const _NOEXCEPT
Definition: xtree:1184
integral_constant< bool, true > true_type
Definition: xtr1common:40
template<class _Traits>
void _Tree< _Traits >::_Assign_rv ( _Myt &&  _Right)
inline
1068  { // assign by moving _Right
1069  _Assign_rv(_STD forward<_Myt>(_Right),
1070  typename _Alty::propagate_on_container_move_assignment());
1071  }
void _Assign_rv(_Myt &&_Right, true_type)
Definition: xtree:1051
static _Nodepref _Right(_Nodeptr _Pnode)
Definition: xtree:681
template<class _Traits>
template<class _Valty >
_Nodeptr _Tree< _Traits >::_Buynode_if_nil ( _Nodeptr  _Node,
_Valty &&   
)
inlineprotected
1629  { // node exists, just return it
1630  return (_Node);
1631  }
_Mybase::_Node _Node
Definition: xtree:968
template<class _Traits>
template<class _Valty >
_Nodeptr _Tree< _Traits >::_Buynode_if_nil ( _Nil  ,
_Valty &&  _Val 
)
inlineprotected
1635  { // node doesn't exist, make it
1636  return (this->_Buynode(_STD forward<_Valty>(_Val)));
1637  }
_In_ int _Val
Definition: vcruntime_string.h:62
_Nodeptr _Buynode(_Valty &&..._Val)
Definition: xtree:879
template<class _Traits>
bool _Tree< _Traits >::_Compare ( const key_type _Left,
const key_type _Right 
) const
inlineprotected
2046  { // compare key_type to key_type, with debug checks
2047  return (_DEBUG_LT_PRED(this->_Getcomp(), _Left, _Right));
2048  }
key_compare & _Getcomp() _NOEXCEPT
Definition: xtree:898
static _Nodepref _Left(_Nodeptr _Pnode)
Definition: xtree:671
static _Nodepref _Right(_Nodeptr _Pnode)
Definition: xtree:681
#define _DEBUG_LT_PRED(pred, x, y)
Definition: xutility:817
template<class _Traits>
template<class _Ty1 , class _Ty2 >
bool _Tree< _Traits >::_Compare ( const _Ty1 &  _Left,
const _Ty2 &  _Right 
) const
inlineprotected
2053  { // compare _Ty1 to _Ty2, without debug checks
2054  return (this->_Getcomp()(_Left, _Right));
2055  }
key_compare & _Getcomp() _NOEXCEPT
Definition: xtree:898
static _Nodepref _Left(_Nodeptr _Pnode)
Definition: xtree:671
static _Nodepref _Right(_Nodeptr _Pnode)
Definition: xtree:681
template<class _Traits>
template<class _Moveit >
void _Tree< _Traits >::_Copy ( const _Myt _Right,
_Moveit  _Movefl 
)
inlineprotected
1920  { // copy or move entire tree from _Right
1921  _Root() = _Copy_nodes(_Right._Root(), this->_Myhead(), _Movefl);
1922  this->_Mysize() = _Right.size();
1923  if (!this->_Isnil(_Root()))
1924  { // nonempty tree, look for new smallest and largest
1925  _Lmost() = this->_Min(_Root());
1926  _Rmost() = this->_Max(_Root());
1927  }
1928  else
1929  { // empty tree, just tidy head pointers
1930  _Lmost() = this->_Myhead();
1931  _Rmost() = this->_Myhead();
1932  }
1933  }
_Nodeptr & _Myhead() _NOEXCEPT
Definition: xtree:928
_Nodeptr & _Lmost() const
Definition: xtree:2075
static _Nodepref _Right(_Nodeptr _Pnode)
Definition: xtree:681
size_type & _Mysize() _NOEXCEPT
Definition: xtree:938
_Nodeptr & _Rmost() const
Definition: xtree:2100
static _Nodeptr _Max(_Nodeptr _Pnode)
Definition: xtree:691
static _Nodeptr _Min(_Nodeptr _Pnode)
Definition: xtree:696
static char & _Isnil(_Nodeptr _Pnode)
Definition: xtree:666
_Nodeptr & _Root() const
Definition: xtree:2105
_Nodeptr _Copy_nodes(_Nodeptr _Rootnode, _Nodeptr _Wherenode, _Moveit _Movefl)
Definition: xtree:1957
template<class _Traits>
template<class _Moveit >
_Nodeptr _Tree< _Traits >::_Copy_nodes ( _Nodeptr  _Rootnode,
_Nodeptr  _Wherenode,
_Moveit  _Movefl 
)
inlineprotected
1959  { // copy entire subtree, recursively
1960  _Nodeptr _Newroot = this->_Myhead(); // point at nil node
1961 
1962  if (!this->_Isnil(_Rootnode))
1963  { // copy or move a node, then any subtrees
1964  typename is_same<key_type, value_type>::type _Is_set;
1965  _Nodeptr _Pnode = _Copy_or_move(
1966  this->_Myval(_Rootnode), _Movefl, _Is_set);
1967  _Pnode->_Parent = _Wherenode;
1968  _Pnode->_Color = this->_Color(_Rootnode);
1969  if (this->_Isnil(_Newroot))
1970  _Newroot = _Pnode; // memorize new root
1971 
1972  _TRY_BEGIN
1973  this->_Left(_Pnode) =
1974  _Copy_nodes(this->_Left(_Rootnode), _Pnode, _Movefl);
1975  this->_Right(_Pnode) =
1976  _Copy_nodes(this->_Right(_Rootnode), _Pnode, _Movefl);
1977  _CATCH_ALL
1978  _Erase(_Newroot); // subtree copy failed, bail out
1979  _RERAISE;
1980  _CATCH_END
1981  }
1982 
1983  return (_Newroot); // return newly constructed tree
1984  }
Definition: xtr1common:22
static _Nodepref _Left(_Nodeptr _Pnode)
Definition: xtree:671
_Nodeptr & _Myhead() _NOEXCEPT
Definition: xtree:928
static _Nodepref _Right(_Nodeptr _Pnode)
Definition: xtree:681
#define _TRY_BEGIN
Definition: xstddef:60
#define _CATCH_END
Definition: xstddef:63
_Mybase::_Nodeptr _Nodeptr
Definition: xtree:969
static char & _Isnil(_Nodeptr _Pnode)
Definition: xtree:666
void _Erase(_Nodeptr _Rootnode)
Definition: xtree:2031
static char & _Color(_Nodeptr _Pnode)
Definition: xtree:661
#define _CATCH_ALL
Definition: xstddef:62
static reference _Myval(_Nodeptr _Pnode)
Definition: xtree:686
#define _RERAISE
Definition: xstddef:74
_Nodeptr _Copy_or_move(_Ty &_Val, _Copy_tag, _Is_set)
Definition: xtree:1937
_Nodeptr _Copy_nodes(_Nodeptr _Rootnode, _Nodeptr _Wherenode, _Moveit _Movefl)
Definition: xtree:1957
template<class _Traits>
template<class _Ty , class _Is_set >
_Nodeptr _Tree< _Traits >::_Copy_or_move ( _Ty &  _Val,
_Copy_tag  ,
_Is_set   
)
inlineprotected
1938  { // copy to new node
1939  return (this->_Buynode(_Val));
1940  }
_In_ int _Val
Definition: vcruntime_string.h:62
_Nodeptr _Buynode(_Valty &&..._Val)
Definition: xtree:879
template<class _Traits>
template<class _Ty >
_Nodeptr _Tree< _Traits >::_Copy_or_move ( _Ty &  _Val,
_Move_tag  ,
true_type   
)
inlineprotected
1944  { // move to new node -- set
1945  return (this->_Buynode(_STD move(_Val)));
1946  }
_In_ int _Val
Definition: vcruntime_string.h:62
_Nodeptr _Buynode(_Valty &&..._Val)
Definition: xtree:879
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1290
template<class _Traits>
template<class _Ty >
_Nodeptr _Tree< _Traits >::_Copy_or_move ( _Ty &  _Val,
_Move_tag  ,
false_type   
)
inlineprotected
1950  { // move to new node -- map
1951  return (this->_Buynode(
1952  _STD move(const_cast<key_type&>(_Val.first)),
1953  _STD move(_Val.second)));
1954  }
_In_ int _Val
Definition: vcruntime_string.h:62
_Nodeptr _Buynode(_Valty &&..._Val)
Definition: xtree:879
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1290
template<class _Traits>
void _Tree< _Traits >::_Destroy_if_not_nil ( _Nodeptr  _Newnode)
inlineprotected
1640  { // node exists, destroy it
1641  this->_Getal().destroy(
1642  _STD addressof(this->_Myval(_Newnode)));
1643 
1644  this->_Getal().deallocate(_Newnode, 1);
1645  }
constexpr _Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:723
_Alty & _Getal() _NOEXCEPT
Definition: xtree:908
static reference _Myval(_Nodeptr _Pnode)
Definition: xtree:686
template<class _Traits>
void _Tree< _Traits >::_Destroy_if_not_nil ( _Nil  )
inlineprotected
1648  { // node doesn't exist, do nothing
1649  }
template<class _Traits>
template<class _Other >
_Paircc _Tree< _Traits >::_Eqrange ( const _Other &  _Keyval) const
inlineprotected
1988  { // find leftmost node not less than _Keyval
1989  _Nodeptr _Pnode = _Root();
1990  _Nodeptr _Lonode = this->_Myhead(); // end() if search fails
1991  _Nodeptr _Hinode = this->_Myhead(); // end() if search fails
1992 
1993  while (!this->_Isnil(_Pnode))
1994  if (_DEBUG_LT_PRED(this->_Getcomp(), this->_Key(_Pnode), _Keyval))
1995  _Pnode = this->_Right(_Pnode); // descend right subtree
1996  else
1997  { // _Pnode not less than _Keyval, remember it
1998  if (this->_Isnil(_Hinode)
1999  && _DEBUG_LT_PRED(this->_Getcomp(), _Keyval,
2000  this->_Key(_Pnode)))
2001  _Hinode = _Pnode; // _Pnode greater, remember it
2002  _Lonode = _Pnode;
2003  _Pnode = this->_Left(_Pnode); // descend left subtree
2004  }
2005 
2006  _Pnode = this->_Isnil(_Hinode) ? _Root()
2007  : this->_Left(_Hinode); // continue scan for upper bound
2008  while (!this->_Isnil(_Pnode))
2009  if (_DEBUG_LT_PRED(this->_Getcomp(), _Keyval, this->_Key(_Pnode)))
2010  { // _Pnode greater than _Keyval, remember it
2011  _Hinode = _Pnode;
2012  _Pnode = this->_Left(_Pnode); // descend left subtree
2013  }
2014  else
2015  _Pnode = this->_Right(_Pnode); // descend right subtree
2016 
2017  const_iterator _First = const_iterator(_Lonode, &this->_Get_data());
2018  const_iterator _Last = const_iterator(_Hinode, &this->_Get_data());
2019  return (_Paircc(_First, _Last));
2020  }
key_compare & _Getcomp() _NOEXCEPT
Definition: xtree:898
static _Nodepref _Left(_Nodeptr _Pnode)
Definition: xtree:671
_Nodeptr & _Myhead() _NOEXCEPT
Definition: xtree:928
static _Nodepref _Right(_Nodeptr _Pnode)
Definition: xtree:681
#define _DEBUG_LT_PRED(pred, x, y)
Definition: xutility:817
_Mybase::const_iterator const_iterator
Definition: xtree:983
const key_type & _Key(_Nodeptr _Pnode) const
Definition: xtree:2176
_Mybase::_Nodeptr _Nodeptr
Definition: xtree:969
static char & _Isnil(_Nodeptr _Pnode)
Definition: xtree:666
pair< const_iterator, const_iterator > _Paircc
Definition: xtree:993
_Nodeptr & _Root() const
Definition: xtree:2105
_Tree_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: xtree:918
_FwdIt _Last
Definition: algorithm:1936
template<class _Traits>
template<class _Other >
_Pairii _Tree< _Traits >::_Eqrange ( const _Other &  _Keyval)
inlineprotected
2024  { // find leftmost node not less than _Keyval
2025  _Paircc _Ans(static_cast<const _Myt *>(this)->_Eqrange(_Keyval));
2026  iterator _First = iterator(_Ans.first._Ptr, &this->_Get_data());
2027  iterator _Last = iterator(_Ans.second._Ptr, &this->_Get_data());
2028  return (_Pairii(_First, _Last));
2029  }
Definition: xutility:563
_If< is_same< key_type, value_type >::value, typename _Mybase::const_iterator, typename _Mybase::iterator >::type iterator
Definition: xtree:986
pair< const_iterator, const_iterator > _Paircc
Definition: xtree:993
pair< iterator, iterator > _Pairii
Definition: xtree:992
_Paircc _Eqrange(const _Other &_Keyval) const
Definition: xtree:1987
_FwdIt _Last
Definition: algorithm:1936
template<class _Traits>
void _Tree< _Traits >::_Erase ( _Nodeptr  _Rootnode)
inlineprotected
2032  { // free entire subtree, recursively
2033  for (_Nodeptr _Pnode = _Rootnode;
2034  !this->_Isnil(_Pnode); _Rootnode = _Pnode)
2035  { // free subtrees, then node
2036  _Erase(this->_Right(_Pnode));
2037  _Pnode = this->_Left(_Pnode);
2038  this->_Getal().destroy(
2039  _STD addressof(this->_Myval(_Rootnode)));
2040 
2041  this->_Getal().deallocate(_Rootnode, 1);
2042  }
2043  }
static _Nodepref _Left(_Nodeptr _Pnode)
Definition: xtree:671
constexpr _Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:723
static _Nodepref _Right(_Nodeptr _Pnode)
Definition: xtree:681
_Alty & _Getal() _NOEXCEPT
Definition: xtree:908
_Mybase::_Nodeptr _Nodeptr
Definition: xtree:969
static char & _Isnil(_Nodeptr _Pnode)
Definition: xtree:666
void _Erase(_Nodeptr _Rootnode)
Definition: xtree:2031
static reference _Myval(_Nodeptr _Pnode)
Definition: xtree:686
template<class _Traits>
template<class _Valty , class _Nodety >
iterator _Tree< _Traits >::_Insert_at ( bool  _Addleft,
_Nodeptr  _Wherenode,
_Valty &&  _Val,
_Nodety  _Node 
)
inlineprotected
1827  { // add node with value next to _Wherenode, to left if _Addleft
1828  if (max_size() - 1 <= this->_Mysize())
1829  { // tree would get too big, fail
1831  _Xlength_error("map/set<T> too long");
1832  }
1833  _Nodeptr _Newnode = _Buynode_if_nil(_Node,
1834  _STD forward<_Valty>(_Val));
1835 
1836  ++this->_Mysize();
1837  _Newnode->_Parent = _Wherenode;
1838 
1839  if (_Wherenode == this->_Myhead())
1840  { // first node in tree, just set head values
1841  _Root() = _Newnode;
1842  _Lmost() = _Newnode;
1843  _Rmost() = _Newnode;
1844  }
1845  else if (_Addleft)
1846  { // add to left of _Wherenode
1847  this->_Left(_Wherenode) = _Newnode;
1848  if (_Wherenode == _Lmost())
1849  _Lmost() = _Newnode;
1850  }
1851  else
1852  { // add to right of _Wherenode
1853  this->_Right(_Wherenode) = _Newnode;
1854  if (_Wherenode == _Rmost())
1855  _Rmost() = _Newnode;
1856  }
1857 
1858  for (_Nodeptr _Pnode = _Newnode;
1859  this->_Color(this->_Parent(_Pnode)) == this->_Red; )
1860  if (this->_Parent(_Pnode)
1861  == this->_Left(this->_Parent(this->_Parent(_Pnode))))
1862  { // fixup red-red in left subtree
1863  _Wherenode =
1864  this->_Right(this->_Parent(this->_Parent(_Pnode)));
1865  if (this->_Color(_Wherenode) == this->_Red)
1866  { // parent has two red children, blacken both
1867  this->_Color(this->_Parent(_Pnode)) = this->_Black;
1868  this->_Color(_Wherenode) = this->_Black;
1869  this->_Color(this->_Parent(this->_Parent(_Pnode)))
1870  = this->_Red;
1871  _Pnode = this->_Parent(this->_Parent(_Pnode));
1872  }
1873  else
1874  { // parent has red and black children
1875  if (_Pnode == this->_Right(this->_Parent(_Pnode)))
1876  { // rotate right child to left
1877  _Pnode = this->_Parent(_Pnode);
1878  _Lrotate(_Pnode);
1879  }
1880  this->_Color(this->_Parent(_Pnode)) =
1881  this->_Black; // propagate red up
1882  this->_Color(this->_Parent(this->_Parent(_Pnode))) =
1883  this->_Red;
1884  _Rrotate(this->_Parent(this->_Parent(_Pnode)));
1885  }
1886  }
1887  else
1888  { // fixup red-red in right subtree
1889  _Wherenode =
1890  this->_Left(this->_Parent(this->_Parent(_Pnode)));
1891  if (this->_Color(_Wherenode) == this->_Red)
1892  { // parent has two red children, blacken both
1893  this->_Color(this->_Parent(_Pnode)) = this->_Black;
1894  this->_Color(_Wherenode) = this->_Black;
1895  this->_Color(this->_Parent(this->_Parent(_Pnode))) =
1896  this->_Red;
1897  _Pnode = this->_Parent(this->_Parent(_Pnode));
1898  }
1899  else
1900  { // parent has red and black children
1901  if (_Pnode == this->_Left(this->_Parent(_Pnode)))
1902  { // rotate left child to right
1903  _Pnode = this->_Parent(_Pnode);
1904  _Rrotate(_Pnode);
1905  }
1906  this->_Color(this->_Parent(_Pnode)) =
1907  this->_Black; // propagate red up
1908  this->_Color(this->_Parent(this->_Parent(_Pnode))) =
1909  this->_Red;
1910  _Lrotate(this->_Parent(this->_Parent(_Pnode)));
1911  }
1912  }
1913 
1914  this->_Color(_Root()) = this->_Black; // root is always black
1915  return (iterator(_Newnode, &this->_Get_data()));
1916  }
void _Lrotate(_Nodeptr _Wherenode)
Definition: xtree:2080
static _Nodepref _Left(_Nodeptr _Pnode)
Definition: xtree:671
void _Destroy_if_not_nil(_Nodeptr _Newnode)
Definition: xtree:1639
_Nodeptr & _Myhead() _NOEXCEPT
Definition: xtree:928
_Nodeptr & _Lmost() const
Definition: xtree:2075
static _Nodepref _Right(_Nodeptr _Pnode)
Definition: xtree:681
Definition: xtree:658
_In_ int _Val
Definition: vcruntime_string.h:62
size_type & _Mysize() _NOEXCEPT
Definition: xtree:938
static _Nodepref _Parent(_Nodeptr _Pnode)
Definition: xtree:676
_Nodeptr & _Rmost() const
Definition: xtree:2100
_Mybase::_Node _Node
Definition: xtree:968
Definition: xtree:658
void _Rrotate(_Nodeptr _Wherenode)
Definition: xtree:2110
_If< is_same< key_type, value_type >::value, typename _Mybase::const_iterator, typename _Mybase::iterator >::type iterator
Definition: xtree:986
_Mybase::_Nodeptr _Nodeptr
Definition: xtree:969
_Nodeptr _Buynode_if_nil(_Nodeptr _Node, _Valty &&)
Definition: xtree:1628
static char & _Color(_Nodeptr _Pnode)
Definition: xtree:661
_Nodeptr & _Root() const
Definition: xtree:2105
size_type max_size() const _NOEXCEPT
Definition: xtree:1174
_Tree_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: xtree:918
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xlength_error(_In_z_ const char *)
template<class _Traits>
template<class _Valty , class _Nodety >
iterator _Tree< _Traits >::_Insert_hint ( const_iterator  _Where,
_Valty &&  _Val,
_Nodety  _Newnode 
)
inlineprotected
1655  { // try to insert node using _Where as a hint
1656  const_iterator _Next;
1657  bool _Leftish = false; // assume nearest point is end of sequence
1658 
1659  _TRY_BEGIN
1660 
1661  #if _ITERATOR_DEBUG_LEVEL == 2
1662  if (_Where._Getcont() != &this->_Get_data())
1663  _DEBUG_ERROR("map/set insert iterator outside range");
1664  #endif /* _ITERATOR_DEBUG_LEVEL == 2 */
1665 
1666  if (size() == 0)
1667  return (_Insert_at(true, this->_Myhead(),
1668  _STD forward<_Valty>(_Val), _Newnode)); // empty tree
1669  else if (this->_Multi)
1670  { // insert even if duplicate
1671  if (_Where == begin())
1672  { // insert at beginning if before first element
1673  if (!_DEBUG_LT_PRED(this->_Getcomp(),
1674  this->_Key(_Where._Mynode()), this->_Kfn(_Val)))
1675  return (_Insert_at(true, _Where._Mynode(),
1676  _STD forward<_Valty>(_Val), _Newnode));
1677  _Leftish = true; // nearest point is beginning of sequence
1678  }
1679  else if (_Where == end())
1680  { // insert at end if after last element
1681  if (!_DEBUG_LT_PRED(this->_Getcomp(),
1682  this->_Kfn(_Val), this->_Key(_Rmost())))
1683  return (_Insert_at(false, _Rmost(),
1684  _STD forward<_Valty>(_Val), _Newnode));
1685  }
1686  else if (!_DEBUG_LT_PRED(this->_Getcomp(),
1687  this->_Key(_Where._Mynode()), this->_Kfn(_Val))
1688  && !_DEBUG_LT_PRED(this->_Getcomp(),
1689  this->_Kfn(_Val),
1690  this->_Key((--(_Next = _Where))._Mynode())))
1691  { // insert before _Where
1692  if (this->_Isnil(this->_Right(_Next._Mynode())))
1693  return (_Insert_at(false, _Next._Mynode(),
1694  _STD forward<_Valty>(_Val), _Newnode));
1695  else
1696  return (_Insert_at(true, _Where._Mynode(),
1697  _STD forward<_Valty>(_Val), _Newnode));
1698  }
1699  else if (!_DEBUG_LT_PRED(this->_Getcomp(),
1700  this->_Kfn(_Val), this->_Key(_Where._Mynode()))
1701  && (++(_Next = _Where) == end()
1702  || !_DEBUG_LT_PRED(this->_Getcomp(),
1703  this->_Key(_Next._Mynode()), this->_Kfn(_Val))))
1704  { // insert after _Where
1705  if (this->_Isnil(this->_Right(_Where._Mynode())))
1706  return (_Insert_at(false, _Where._Mynode(),
1707  _STD forward<_Valty>(_Val), _Newnode));
1708  else
1709  return (_Insert_at(true, _Next._Mynode(),
1710  _STD forward<_Valty>(_Val), _Newnode));
1711  }
1712  else
1713  _Leftish = true; // nearest point is beginning of sequence
1714  }
1715  else
1716  { // insert only if unique
1717  if (_Where == begin())
1718  { // insert at beginning if before first element
1719  if (_DEBUG_LT_PRED(this->_Getcomp(),
1720  this->_Kfn(_Val), this->_Key(_Where._Mynode())))
1721  return (_Insert_at(true, _Where._Mynode(),
1722  _STD forward<_Valty>(_Val), _Newnode));
1723  }
1724  else if (_Where == end())
1725  { // insert at end if after last element
1726  if (_DEBUG_LT_PRED(this->_Getcomp(),
1727  this->_Key(_Rmost()), this->_Kfn(_Val)))
1728  return (_Insert_at(false, _Rmost(),
1729  _STD forward<_Valty>(_Val), _Newnode));
1730  }
1731  else if (_DEBUG_LT_PRED(this->_Getcomp(),
1732  this->_Kfn(_Val), this->_Key(_Where._Mynode()))
1733  && _DEBUG_LT_PRED(this->_Getcomp(),
1734  this->_Key((--(_Next = _Where))._Mynode()),
1735  this->_Kfn(_Val)))
1736  { // insert before _Where
1737  if (this->_Isnil(this->_Right(_Next._Mynode())))
1738  return (_Insert_at(false, _Next._Mynode(),
1739  _STD forward<_Valty>(_Val), _Newnode));
1740  else
1741  return (_Insert_at(true, _Where._Mynode(),
1742  _STD forward<_Valty>(_Val), _Newnode));
1743  }
1744  else if (_DEBUG_LT_PRED(this->_Getcomp(),
1745  this->_Key(_Where._Mynode()), this->_Kfn(_Val))
1746  && (++(_Next = _Where) == end()
1747  || _DEBUG_LT_PRED(this->_Getcomp(),
1748  this->_Kfn(_Val), this->_Key(_Next._Mynode()))))
1749  { // insert after _Where
1750  if (this->_Isnil(this->_Right(_Where._Mynode())))
1751  return (_Insert_at(false, _Where._Mynode(),
1752  _STD forward<_Valty>(_Val), _Newnode));
1753  else
1754  return (_Insert_at(true, _Next._Mynode(),
1755  _STD forward<_Valty>(_Val), _Newnode));
1756  }
1757  }
1758  _CATCH_ALL
1759  _Destroy_if_not_nil(_Newnode);
1760  _RERAISE;
1761  _CATCH_END
1762 
1763  return (_Insert_nohint(_Leftish,
1764  _STD forward<_Valty>(_Val), _Newnode).first);
1765  }
key_compare & _Getcomp() _NOEXCEPT
Definition: xtree:898
void _Destroy_if_not_nil(_Nodeptr _Newnode)
Definition: xtree:1639
_Nodeptr & _Myhead() _NOEXCEPT
Definition: xtree:928
static _Nodepref _Right(_Nodeptr _Pnode)
Definition: xtree:681
#define _TRY_BEGIN
Definition: xstddef:60
#define _CATCH_END
Definition: xstddef:63
#define _DEBUG_LT_PRED(pred, x, y)
Definition: xutility:817
_In_ int _Val
Definition: vcruntime_string.h:62
Definition: xtree:966
_Nodeptr & _Rmost() const
Definition: xtree:2100
_Mybase::const_iterator const_iterator
Definition: xtree:983
iterator _Insert_at(bool _Addleft, _Nodeptr _Wherenode, _Valty &&_Val, _Nodety _Node)
Definition: xtree:1825
iterator end() _NOEXCEPT
Definition: xtree:1119
const key_type & _Key(_Nodeptr _Pnode) const
Definition: xtree:2176
static char & _Isnil(_Nodeptr _Pnode)
Definition: xtree:666
#define _CATCH_ALL
Definition: xstddef:62
iterator begin() _NOEXCEPT
Definition: xtree:1109
_Tree_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: xtree:918
#define _DEBUG_ERROR(mesg)
Definition: xutility:32
_Pairib _Insert_nohint(bool _Leftish, _Valty &&_Val, _Nodety _Newnode)
Definition: xtree:1769
size_type size() const _NOEXCEPT
Definition: xtree:1169
#define _RERAISE
Definition: xstddef:74
const key_type & _Kfn(const value_type &_Val) const
Definition: xtree:2171
template<class _Traits>
template<class _Valty , class _Nodety >
_Pairib _Tree< _Traits >::_Insert_nohint ( bool  _Leftish,
_Valty &&  _Val,
_Nodety  _Newnode 
)
inlineprotected
1771  { // try to insert node, on left if _Leftish
1772  _TRY_BEGIN
1773  _Nodeptr _Trynode = _Root();
1774  _Nodeptr _Wherenode = this->_Myhead();
1775  bool _Addleft = true; // add to left of head if tree empty
1776 
1777  while (!this->_Isnil(_Trynode))
1778  { // look for leaf to insert before (_Addleft) or after
1779  _Wherenode = _Trynode;
1780  if (_Leftish)
1781  _Addleft = !_DEBUG_LT_PRED(this->_Getcomp(),
1782  this->_Key(_Trynode),
1783  this->_Kfn(_Val)); // favor left end
1784  else
1785  _Addleft = _DEBUG_LT_PRED(this->_Getcomp(),
1786  this->_Kfn(_Val),
1787  this->_Key(_Trynode)); // favor right end
1788  _Trynode = _Addleft ? this->_Left(_Trynode)
1789  : this->_Right(_Trynode);
1790  }
1791 
1792  if (this->_Multi)
1793  return (_Pairib(_Insert_at(_Addleft, _Wherenode,
1794  _STD forward<_Valty>(_Val), _Newnode), true));
1795  else
1796  { // insert only if unique
1797  iterator _Where = iterator(_Wherenode, &this->_Get_data());
1798  if (!_Addleft)
1799  ; // need to test if insert after is okay
1800  else if (_Where == begin())
1801  return (_Pairib(_Insert_at(true, _Wherenode,
1802  _STD forward<_Valty>(_Val), _Newnode), true));
1803  else
1804  --_Where; // need to test if insert before is okay
1805 
1806  if (_DEBUG_LT_PRED(this->_Getcomp(),
1807  this->_Key(_Where._Mynode()),
1808  this->_Kfn(_Val)))
1809  return (_Pairib(_Insert_at(_Addleft, _Wherenode,
1810  _STD forward<_Valty>(_Val), _Newnode), true));
1811  else
1812  { // duplicate, don't insert
1813  _Destroy_if_not_nil(_Newnode);
1814  return (_Pairib(_Where, false));
1815  }
1816  }
1817  _CATCH_ALL
1818  _Destroy_if_not_nil(_Newnode);
1819  _RERAISE;
1820  _CATCH_END
1821  }
key_compare & _Getcomp() _NOEXCEPT
Definition: xtree:898
static _Nodepref _Left(_Nodeptr _Pnode)
Definition: xtree:671
void _Destroy_if_not_nil(_Nodeptr _Newnode)
Definition: xtree:1639
_Nodeptr & _Myhead() _NOEXCEPT
Definition: xtree:928
static _Nodepref _Right(_Nodeptr _Pnode)
Definition: xtree:681
#define _TRY_BEGIN
Definition: xstddef:60
#define _CATCH_END
Definition: xstddef:63
#define _DEBUG_LT_PRED(pred, x, y)
Definition: xutility:817
Definition: xutility:563
_In_ int _Val
Definition: vcruntime_string.h:62
Definition: xtree:966
pair< iterator, bool > _Pairib
Definition: xtree:991
iterator _Insert_at(bool _Addleft, _Nodeptr _Wherenode, _Valty &&_Val, _Nodety _Node)
Definition: xtree:1825
_If< is_same< key_type, value_type >::value, typename _Mybase::const_iterator, typename _Mybase::iterator >::type iterator
Definition: xtree:986
const key_type & _Key(_Nodeptr _Pnode) const
Definition: xtree:2176
_Mybase::_Nodeptr _Nodeptr
Definition: xtree:969
static char & _Isnil(_Nodeptr _Pnode)
Definition: xtree:666
_Nodeptr & _Root() const
Definition: xtree:2105
#define _CATCH_ALL
Definition: xstddef:62
iterator begin() _NOEXCEPT
Definition: xtree:1109
_Tree_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: xtree:918
#define _RERAISE
Definition: xstddef:74
const key_type & _Kfn(const value_type &_Val) const
Definition: xtree:2171
template<class _Traits>
const key_type& _Tree< _Traits >::_Key ( _Nodeptr  _Pnode) const
inlineprotected
2177  { // return reference to key in node
2178  return ((const key_type&)this->_Kfn(this->_Myval(_Pnode)));
2179  }
_Traits::key_type key_type
Definition: xtree:962
static reference _Myval(_Nodeptr _Pnode)
Definition: xtree:686
const key_type & _Kfn(const value_type &_Val) const
Definition: xtree:2171
template<class _Traits>
const key_type& _Tree< _Traits >::_Kfn ( const value_type _Val) const
inlineprotected
2172  { // get key from value
2173  return (_Traits::_Kfn(_Val));
2174  }
_In_ int _Val
Definition: vcruntime_string.h:62
template<class _Traits>
template<class _Other >
_Nodeptr _Tree< _Traits >::_Lbound ( const _Other &  _Keyval) const
inlineprotected
2059  { // find leftmost node not less than _Keyval
2060  _Nodeptr _Pnode = _Root();
2061  _Nodeptr _Wherenode = this->_Myhead(); // end() if search fails
2062 
2063  while (!this->_Isnil(_Pnode))
2064  if (_Compare(this->_Key(_Pnode), _Keyval))
2065  _Pnode = this->_Right(_Pnode); // descend right subtree
2066  else
2067  { // _Pnode not less than _Keyval, remember it
2068  _Wherenode = _Pnode;
2069  _Pnode = this->_Left(_Pnode); // descend left subtree
2070  }
2071 
2072  return (_Wherenode); // return best remembered candidate
2073  }
static _Nodepref _Left(_Nodeptr _Pnode)
Definition: xtree:671
_Nodeptr & _Myhead() _NOEXCEPT
Definition: xtree:928
static _Nodepref _Right(_Nodeptr _Pnode)
Definition: xtree:681
bool _Compare(const key_type &_Left, const key_type &_Right) const
Definition: xtree:2045
const key_type & _Key(_Nodeptr _Pnode) const
Definition: xtree:2176
_Mybase::_Nodeptr _Nodeptr
Definition: xtree:969
static char & _Isnil(_Nodeptr _Pnode)
Definition: xtree:666
_Nodeptr & _Root() const
Definition: xtree:2105
template<class _Traits>
_Nodeptr& _Tree< _Traits >::_Lmost ( ) const
inlineprotected
2076  { // return leftmost node in nonmutable tree
2077  return (this->_Left(this->_Myhead()));
2078  }
static _Nodepref _Left(_Nodeptr _Pnode)
Definition: xtree:671
_Nodeptr & _Myhead() _NOEXCEPT
Definition: xtree:928
template<class _Traits>
void _Tree< _Traits >::_Lrotate ( _Nodeptr  _Wherenode)
inlineprotected
2081  { // promote right node to root of subtree
2082  _Nodeptr _Pnode = this->_Right(_Wherenode);
2083  this->_Right(_Wherenode) = this->_Left(_Pnode);
2084 
2085  if (!this->_Isnil(this->_Left(_Pnode)))
2086  this->_Parent(this->_Left(_Pnode)) = _Wherenode;
2087  this->_Parent(_Pnode) = this->_Parent(_Wherenode);
2088 
2089  if (_Wherenode == _Root())
2090  _Root() = _Pnode;
2091  else if (_Wherenode == this->_Left(this->_Parent(_Wherenode)))
2092  this->_Left(this->_Parent(_Wherenode)) = _Pnode;
2093  else
2094  this->_Right(this->_Parent(_Wherenode)) = _Pnode;
2095 
2096  this->_Left(_Pnode) = _Wherenode;
2097  this->_Parent(_Wherenode) = _Pnode;
2098  }
static _Nodepref _Left(_Nodeptr _Pnode)
Definition: xtree:671
static _Nodepref _Right(_Nodeptr _Pnode)
Definition: xtree:681
static _Nodepref _Parent(_Nodeptr _Pnode)
Definition: xtree:676
_Mybase::_Nodeptr _Nodeptr
Definition: xtree:969
static char & _Isnil(_Nodeptr _Pnode)
Definition: xtree:666
_Nodeptr & _Root() const
Definition: xtree:2105
template<class _Traits>
_Nodeptr& _Tree< _Traits >::_Rmost ( ) const
inlineprotected
2101  { // return rightmost node in nonmutable tree
2102  return (this->_Right(this->_Myhead()));
2103  }
_Nodeptr & _Myhead() _NOEXCEPT
Definition: xtree:928
static _Nodepref _Right(_Nodeptr _Pnode)
Definition: xtree:681
template<class _Traits>
_Nodeptr& _Tree< _Traits >::_Root ( ) const
inlineprotected
2106  { // return root of nonmutable tree
2107  return (this->_Parent(this->_Myhead()));
2108  }
_Nodeptr & _Myhead() _NOEXCEPT
Definition: xtree:928
static _Nodepref _Parent(_Nodeptr _Pnode)
Definition: xtree:676
template<class _Traits>
void _Tree< _Traits >::_Rrotate ( _Nodeptr  _Wherenode)
inlineprotected
2111  { // promote left node to root of subtree
2112  _Nodeptr _Pnode = this->_Left(_Wherenode);
2113  this->_Left(_Wherenode) = this->_Right(_Pnode);
2114 
2115  if (!this->_Isnil(this->_Right(_Pnode)))
2116  this->_Parent(this->_Right(_Pnode)) = _Wherenode;
2117  this->_Parent(_Pnode) = this->_Parent(_Wherenode);
2118 
2119  if (_Wherenode == _Root())
2120  _Root() = _Pnode;
2121  else if (_Wherenode == this->_Right(this->_Parent(_Wherenode)))
2122  this->_Right(this->_Parent(_Wherenode)) = _Pnode;
2123  else
2124  this->_Left(this->_Parent(_Wherenode)) = _Pnode;
2125 
2126  this->_Right(_Pnode) = _Wherenode;
2127  this->_Parent(_Wherenode) = _Pnode;
2128  }
static _Nodepref _Left(_Nodeptr _Pnode)
Definition: xtree:671
static _Nodepref _Right(_Nodeptr _Pnode)
Definition: xtree:681
static _Nodepref _Parent(_Nodeptr _Pnode)
Definition: xtree:676
_Mybase::_Nodeptr _Nodeptr
Definition: xtree:969
static char & _Isnil(_Nodeptr _Pnode)
Definition: xtree:666
_Nodeptr & _Root() const
Definition: xtree:2105
template<class _Traits>
void _Tree< _Traits >::_Tidy ( )
inlineprotected
2167  { // free all storage
2168  erase(begin(), end());
2169  }
iterator end() _NOEXCEPT
Definition: xtree:1119
iterator erase(const_iterator _Where)
Definition: xtree:1258
iterator begin() _NOEXCEPT
Definition: xtree:1109
template<class _Traits>
template<class _Other >
_Nodeptr _Tree< _Traits >::_Ubound ( const _Other &  _Keyval) const
inlineprotected
2132  { // find leftmost node greater than _Keyval
2133  _Nodeptr _Pnode = _Root();
2134  _Nodeptr _Wherenode = this->_Myhead(); // end() if search fails
2135 
2136  while (!this->_Isnil(_Pnode))
2137  if (_Compare(_Keyval, this->_Key(_Pnode)))
2138  { // _Pnode greater than _Keyval, remember it
2139  _Wherenode = _Pnode;
2140  _Pnode = this->_Left(_Pnode); // descend left subtree
2141  }
2142  else
2143  _Pnode = this->_Right(_Pnode); // descend right subtree
2144 
2145  return (_Wherenode); // return best remembered candidate
2146  }
static _Nodepref _Left(_Nodeptr _Pnode)
Definition: xtree:671
_Nodeptr & _Myhead() _NOEXCEPT
Definition: xtree:928
static _Nodepref _Right(_Nodeptr _Pnode)
Definition: xtree:681
bool _Compare(const key_type &_Left, const key_type &_Right) const
Definition: xtree:2045
const key_type & _Key(_Nodeptr _Pnode) const
Definition: xtree:2176
_Mybase::_Nodeptr _Nodeptr
Definition: xtree:969
static char & _Isnil(_Nodeptr _Pnode)
Definition: xtree:666
_Nodeptr & _Root() const
Definition: xtree:2105
template<class _Traits>
iterator _Tree< _Traits >::begin ( )
inline
1110  { // return iterator for beginning of mutable sequence
1111  return (iterator(_Lmost(), &this->_Get_data()));
1112  }
_Nodeptr & _Lmost() const
Definition: xtree:2075
_If< is_same< key_type, value_type >::value, typename _Mybase::const_iterator, typename _Mybase::iterator >::type iterator
Definition: xtree:986
_Tree_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: xtree:918
template<class _Traits>
const_iterator _Tree< _Traits >::begin ( ) const
inline
1115  { // return iterator for beginning of nonmutable sequence
1116  return (const_iterator(_Lmost(), &this->_Get_data()));
1117  }
_Nodeptr & _Lmost() const
Definition: xtree:2075
_Mybase::const_iterator const_iterator
Definition: xtree:983
_Tree_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: xtree:918
template<class _Traits>
const_iterator _Tree< _Traits >::cbegin ( ) const
inline
1150  { // return iterator for beginning of nonmutable sequence
1151  return (begin());
1152  }
iterator begin() _NOEXCEPT
Definition: xtree:1109
template<class _Traits>
const_iterator _Tree< _Traits >::cend ( ) const
inline
1155  { // return iterator for end of nonmutable sequence
1156  return (end());
1157  }
iterator end() _NOEXCEPT
Definition: xtree:1119
template<class _Traits>
void _Tree< _Traits >::clear ( )
inline
1467  { // erase all
1468  #if _ITERATOR_DEBUG_LEVEL == 2
1469  this->_Orphan_ptr(nullptr_t{});
1470  #endif /* _ITERATOR_DEBUG_LEVEL == 2 */
1471 
1472  _Erase(_Root());
1473  _Root() = this->_Myhead();
1474  _Lmost() = this->_Myhead();
1475  _Rmost() = this->_Myhead();
1476  this->_Mysize() = 0;
1477  }
_Nodeptr & _Myhead() _NOEXCEPT
Definition: xtree:928
_Nodeptr & _Lmost() const
Definition: xtree:2075
size_type & _Mysize() _NOEXCEPT
Definition: xtree:938
_Nodeptr & _Rmost() const
Definition: xtree:2100
void _Erase(_Nodeptr _Rootnode)
Definition: xtree:2031
_Nodeptr & _Root() const
Definition: xtree:2105
template<class _Traits>
size_type _Tree< _Traits >::count ( const key_type _Keyval) const
inline
1522  { // count all elements that match _Keyval
1523  _Paircc _Ans = equal_range(_Keyval);
1524  return (_STD distance(_Ans.first, _Ans.second));
1525  }
_Iter_diff_t< _InIt > distance(_InIt _First, _InIt _Last)
Definition: xutility:1124
_Pairii equal_range(const key_type &_Keyval)
Definition: xtree:1588
pair< const_iterator, const_iterator > _Paircc
Definition: xtree:993
template<class _Traits>
template<class _Other , class _Mycomp = key_compare, class = typename _Mycomp::is_transparent>
size_type _Tree< _Traits >::count ( const _Other &  _Keyval) const
inline
1531  { // count all elements that match _Keyval
1532  _Paircc _Ans = equal_range(_Keyval);
1533  return (_STD distance(_Ans.first, _Ans.second));
1534  }
_Iter_diff_t< _InIt > distance(_InIt _First, _InIt _Last)
Definition: xutility:1124
_Pairii equal_range(const key_type &_Keyval)
Definition: xtree:1588
pair< const_iterator, const_iterator > _Paircc
Definition: xtree:993
template<class _Traits>
const_reverse_iterator _Tree< _Traits >::crbegin ( ) const
inline
1160  { // return iterator for beginning of reversed nonmutable sequence
1161  return (rbegin());
1162  }
reverse_iterator rbegin() _NOEXCEPT
Definition: xtree:1129
template<class _Traits>
const_reverse_iterator _Tree< _Traits >::crend ( ) const
inline
1165  { // return iterator for end of reversed nonmutable sequence
1166  return (rend());
1167  }
reverse_iterator rend() _NOEXCEPT
Definition: xtree:1139
template<class _Traits>
template<class... _Valty>
_Pairib _Tree< _Traits >::emplace ( _Valty &&...  _Val)
inline
1075  { // try to insert value_type(_Val...), favoring right side
1076  _Nodeptr _Newnode = this->_Buynode(_STD forward<_Valty>(_Val)...);
1077  return (_Insert_nohint(false,
1078  this->_Myval(_Newnode), _Newnode));
1079  }
_In_ int _Val
Definition: vcruntime_string.h:62
_Mybase::_Nodeptr _Nodeptr
Definition: xtree:969
_Nodeptr _Buynode(_Valty &&..._Val)
Definition: xtree:879
static reference _Myval(_Nodeptr _Pnode)
Definition: xtree:686
_Pairib _Insert_nohint(bool _Leftish, _Valty &&_Val, _Nodety _Newnode)
Definition: xtree:1769
template<class _Traits>
template<class... _Valty>
iterator _Tree< _Traits >::emplace_hint ( const_iterator  _Where,
_Valty &&...  _Val 
)
inline
1083  { // insert value_type(_Val...) at _Where
1084  _Nodeptr _Newnode = this->_Buynode(_STD forward<_Valty>(_Val)...);
1085  return (_Insert_hint(_Where,
1086  this->_Myval(_Newnode), _Newnode));
1087  }
_In_ int _Val
Definition: vcruntime_string.h:62
iterator _Insert_hint(const_iterator _Where, _Valty &&_Val, _Nodety _Newnode)
Definition: xtree:1653
_Mybase::_Nodeptr _Nodeptr
Definition: xtree:969
_Nodeptr _Buynode(_Valty &&..._Val)
Definition: xtree:879
static reference _Myval(_Nodeptr _Pnode)
Definition: xtree:686
template<class _Traits>
bool _Tree< _Traits >::empty ( ) const
inline
1180  { // return true only if sequence is empty
1181  return (size() == 0);
1182  }
size_type size() const _NOEXCEPT
Definition: xtree:1169
template<class _Traits>
iterator _Tree< _Traits >::end ( )
inline
1120  { // return iterator for end of mutable sequence
1121  return (iterator(this->_Myhead(), &this->_Get_data()));
1122  }
_Nodeptr & _Myhead() _NOEXCEPT
Definition: xtree:928
_If< is_same< key_type, value_type >::value, typename _Mybase::const_iterator, typename _Mybase::iterator >::type iterator
Definition: xtree:986
_Tree_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: xtree:918
template<class _Traits>
const_iterator _Tree< _Traits >::end ( ) const
inline
1125  { // return iterator for end of nonmutable sequence
1126  return (const_iterator(this->_Myhead(), &this->_Get_data()));
1127  }
_Nodeptr & _Myhead() _NOEXCEPT
Definition: xtree:928
_Mybase::const_iterator const_iterator
Definition: xtree:983
_Tree_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: xtree:918
template<class _Traits>
_Pairii _Tree< _Traits >::equal_range ( const key_type _Keyval)
inline
1589  { // find range equivalent to _Keyval in mutable tree
1590  return (_Eqrange(_Keyval));
1591  }
_Paircc _Eqrange(const _Other &_Keyval) const
Definition: xtree:1987
template<class _Traits>
_Paircc _Tree< _Traits >::equal_range ( const key_type _Keyval) const
inline
1594  { // find range equivalent to _Keyval in nonmutable tree
1595  return (_Eqrange(_Keyval));
1596  }
_Paircc _Eqrange(const _Other &_Keyval) const
Definition: xtree:1987
template<class _Traits>
template<class _Other , class _Mycomp = key_compare, class = typename _Mycomp::is_transparent>
_Pairii _Tree< _Traits >::equal_range ( const _Other &  _Keyval)
inline
1602  { // find range equivalent to _Keyval in mutable tree
1603  return (_Eqrange(_Keyval));
1604  }
_Paircc _Eqrange(const _Other &_Keyval) const
Definition: xtree:1987
template<class _Traits>
template<class _Other , class _Mycomp = key_compare, class = typename _Mycomp::is_transparent>
_Paircc _Tree< _Traits >::equal_range ( const _Other &  _Keyval) const
inline
1610  { // find range equivalent to _Keyval in nonmutable tree
1611  return (_Eqrange(_Keyval));
1612  }
_Paircc _Eqrange(const _Other &_Keyval) const
Definition: xtree:1987
template<class _Traits>
iterator _Tree< _Traits >::erase ( const_iterator  _Where)
inline
1259  { // erase element at _Where
1260  #if _ITERATOR_DEBUG_LEVEL == 2
1261  if (_Where._Getcont() != &this->_Get_data()
1262  || this->_Isnil(_Where._Mynode()))
1263  _DEBUG_ERROR("map/set erase iterator outside range");
1264  _Nodeptr _Erasednode = _Where._Mynode(); // node to erase
1265  ++_Where; // save successor iterator for return
1266  _Orphan_ptr(_Erasednode);
1267 
1268  #else /* _ITERATOR_DEBUG_LEVEL == 2 */
1269  _Nodeptr _Erasednode = _Where._Mynode(); // node to erase
1270  ++_Where; // save successor iterator for return
1271  #endif /* _ITERATOR_DEBUG_LEVEL == 2 */
1272 
1273  _Nodeptr _Fixnode; // the node to recolor as needed
1274  _Nodeptr _Fixnodeparent; // parent of _Fixnode (which may be nil)
1275  _Nodeptr _Pnode = _Erasednode;
1276 
1277  if (this->_Isnil(this->_Left(_Pnode)))
1278  _Fixnode = this->_Right(_Pnode); // stitch up right subtree
1279  else if (this->_Isnil(this->_Right(_Pnode)))
1280  _Fixnode = this->_Left(_Pnode); // stitch up left subtree
1281  else
1282  { // two subtrees, must lift successor node to replace erased
1283  _Pnode = _Where._Mynode(); // _Pnode is successor node
1284  _Fixnode = this->_Right(_Pnode); // _Fixnode is only subtree
1285  }
1286 
1287  if (_Pnode == _Erasednode)
1288  { // at most one subtree, relink it
1289  _Fixnodeparent = this->_Parent(_Erasednode);
1290  if (!this->_Isnil(_Fixnode))
1291  this->_Parent(_Fixnode) = _Fixnodeparent; // link up
1292 
1293  if (_Root() == _Erasednode)
1294  _Root() = _Fixnode; // link down from root
1295  else if (this->_Left(_Fixnodeparent) == _Erasednode)
1296  this->_Left(_Fixnodeparent) = _Fixnode; // link down to left
1297  else
1298  this->_Right(_Fixnodeparent) =
1299  _Fixnode; // link down to right
1300 
1301  if (_Lmost() == _Erasednode)
1302  _Lmost() = this->_Isnil(_Fixnode)
1303  ? _Fixnodeparent // smallest is parent of erased node
1304  : this->_Min(_Fixnode); // smallest in relinked subtree
1305 
1306  if (_Rmost() == _Erasednode)
1307  _Rmost() = this->_Isnil(_Fixnode)
1308  ? _Fixnodeparent // largest is parent of erased node
1309  : this->_Max(_Fixnode); // largest in relinked subtree
1310  }
1311  else
1312  { // erased has two subtrees, _Pnode is successor to erased
1313  this->_Parent(this->_Left(_Erasednode)) =
1314  _Pnode; // link left up
1315  this->_Left(_Pnode) =
1316  this->_Left(_Erasednode); // link successor down
1317 
1318  if (_Pnode == this->_Right(_Erasednode))
1319  _Fixnodeparent = _Pnode; // successor is next to erased
1320  else
1321  { // successor further down, link in place of erased
1322  _Fixnodeparent =
1323  this->_Parent(_Pnode); // parent is successor's
1324  if (!this->_Isnil(_Fixnode))
1325  this->_Parent(_Fixnode) = _Fixnodeparent; // link fix up
1326  this->_Left(_Fixnodeparent) = _Fixnode; // link fix down
1327  this->_Right(_Pnode) =
1328  this->_Right(_Erasednode); // link next down
1329  this->_Parent(this->_Right(_Erasednode)) =
1330  _Pnode; // right up
1331  }
1332 
1333  if (_Root() == _Erasednode)
1334  _Root() = _Pnode; // link down from root
1335  else if (this->_Left(this->_Parent(_Erasednode)) == _Erasednode)
1336  this->_Left(this->_Parent(_Erasednode)) =
1337  _Pnode; // link down to left
1338  else
1339  this->_Right(this->_Parent(_Erasednode)) =
1340  _Pnode; // link down to right
1341 
1342  this->_Parent(_Pnode) =
1343  this->_Parent(_Erasednode); // link successor up
1344  _STD swap(this->_Color(_Pnode),
1345  this->_Color(_Erasednode)); // recolor it
1346  }
1347 
1348  if (this->_Color(_Erasednode) == this->_Black)
1349  { // erasing black link, must recolor/rebalance tree
1350  for (; _Fixnode != _Root()
1351  && this->_Color(_Fixnode) == this->_Black;
1352  _Fixnodeparent = this->_Parent(_Fixnode))
1353  if (_Fixnode == this->_Left(_Fixnodeparent))
1354  { // fixup left subtree
1355  _Pnode = this->_Right(_Fixnodeparent);
1356  if (this->_Color(_Pnode) == this->_Red)
1357  { // rotate red up from right subtree
1358  this->_Color(_Pnode) = this->_Black;
1359  this->_Color(_Fixnodeparent) = this->_Red;
1360  _Lrotate(_Fixnodeparent);
1361  _Pnode = this->_Right(_Fixnodeparent);
1362  }
1363 
1364  if (this->_Isnil(_Pnode))
1365  _Fixnode = _Fixnodeparent; // shouldn't happen
1366  else if (this->_Color(this->_Left(_Pnode)) == this->_Black
1367  && this->_Color(this->_Right(_Pnode)) == this->_Black)
1368  { // redden right subtree with black children
1369  this->_Color(_Pnode) = this->_Red;
1370  _Fixnode = _Fixnodeparent;
1371  }
1372  else
1373  { // must rearrange right subtree
1374  if (this->_Color(this->_Right(_Pnode))
1375  == this->_Black)
1376  { // rotate red up from left sub-subtree
1377  this->_Color(this->_Left(_Pnode)) = this->_Black;
1378  this->_Color(_Pnode) = this->_Red;
1379  _Rrotate(_Pnode);
1380  _Pnode = this->_Right(_Fixnodeparent);
1381  }
1382 
1383  this->_Color(_Pnode) = this->_Color(_Fixnodeparent);
1384  this->_Color(_Fixnodeparent) = this->_Black;
1385  this->_Color(this->_Right(_Pnode)) = this->_Black;
1386  _Lrotate(_Fixnodeparent);
1387  break; // tree now recolored/rebalanced
1388  }
1389  }
1390  else
1391  { // fixup right subtree
1392  _Pnode = this->_Left(_Fixnodeparent);
1393  if (this->_Color(_Pnode) == this->_Red)
1394  { // rotate red up from left subtree
1395  this->_Color(_Pnode) = this->_Black;
1396  this->_Color(_Fixnodeparent) = this->_Red;
1397  _Rrotate(_Fixnodeparent);
1398  _Pnode = this->_Left(_Fixnodeparent);
1399  }
1400 
1401  if (this->_Isnil(_Pnode))
1402  _Fixnode = _Fixnodeparent; // shouldn't happen
1403  else if (this->_Color(this->_Right(_Pnode)) ==
1404  this->_Black
1405  && this->_Color(this->_Left(_Pnode)) == this->_Black)
1406  { // redden left subtree with black children
1407  this->_Color(_Pnode) = this->_Red;
1408  _Fixnode = _Fixnodeparent;
1409  }
1410  else
1411  { // must rearrange left subtree
1412  if (this->_Color(this->_Left(_Pnode)) == this->_Black)
1413  { // rotate red up from right sub-subtree
1414  this->_Color(this->_Right(_Pnode)) = this->_Black;
1415  this->_Color(_Pnode) = this->_Red;
1416  _Lrotate(_Pnode);
1417  _Pnode = this->_Left(_Fixnodeparent);
1418  }
1419 
1420  this->_Color(_Pnode) = this->_Color(_Fixnodeparent);
1421  this->_Color(_Fixnodeparent) = this->_Black;
1422  this->_Color(this->_Left(_Pnode)) = this->_Black;
1423  _Rrotate(_Fixnodeparent);
1424  break; // tree now recolored/rebalanced
1425  }
1426  }
1427 
1428  this->_Color(_Fixnode) = this->_Black; // stopping node is black
1429  }
1430 
1431  this->_Getal().destroy(
1432  _STD addressof(this->_Myval(_Erasednode))); // delete erased node
1433 
1434  this->_Getal().deallocate(_Erasednode, 1);
1435 
1436  if (0 < this->_Mysize())
1437  --this->_Mysize();
1438 
1439  return (iterator(_Where._Ptr,
1440  &this->_Get_data())); // return successor iterator
1441  }
void _Lrotate(_Nodeptr _Wherenode)
Definition: xtree:2080
static _Nodepref _Left(_Nodeptr _Pnode)
Definition: xtree:671
constexpr _Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:723
_Nodeptr & _Lmost() const
Definition: xtree:2075
static _Nodepref _Right(_Nodeptr _Pnode)
Definition: xtree:681
Definition: xtree:658
size_type & _Mysize() _NOEXCEPT
Definition: xtree:938
static _Nodepref _Parent(_Nodeptr _Pnode)
Definition: xtree:676
_Nodeptr & _Rmost() const
Definition: xtree:2100
void swap(_Myt &_Right)
Definition: xtree:1614
Definition: xtree:658
void _Rrotate(_Nodeptr _Wherenode)
Definition: xtree:2110
_Alty & _Getal() _NOEXCEPT
Definition: xtree:908
static _Nodeptr _Max(_Nodeptr _Pnode)
Definition: xtree:691
_If< is_same< key_type, value_type >::value, typename _Mybase::const_iterator, typename _Mybase::iterator >::type iterator
Definition: xtree:986
static _Nodeptr _Min(_Nodeptr _Pnode)
Definition: xtree:696
_Mybase::_Nodeptr _Nodeptr
Definition: xtree:969
static char & _Isnil(_Nodeptr _Pnode)
Definition: xtree:666
static char & _Color(_Nodeptr _Pnode)
Definition: xtree:661
_Nodeptr & _Root() const
Definition: xtree:2105
static reference _Myval(_Nodeptr _Pnode)
Definition: xtree:686
_Tree_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: xtree:918
#define _DEBUG_ERROR(mesg)
Definition: xutility:32
template<class _Traits>
iterator _Tree< _Traits >::erase ( const_iterator  _First,
const_iterator  _Last 
)
inline
1444  { // erase [_First, _Last)
1445  if (_First == begin() && _Last == end())
1446  { // erase all
1447  clear();
1448  return (begin());
1449  }
1450  else
1451  { // partial erase, one at a time
1452  while (_First != _Last)
1453  erase(_First++);
1454  return (iterator(_First._Ptr, &this->_Get_data()));
1455  }
1456  }
iterator end() _NOEXCEPT
Definition: xtree:1119
_If< is_same< key_type, value_type >::value, typename _Mybase::const_iterator, typename _Mybase::iterator >::type iterator
Definition: xtree:986
void clear() _NOEXCEPT
Definition: xtree:1466
iterator erase(const_iterator _Where)
Definition: xtree:1258
iterator begin() _NOEXCEPT
Definition: xtree:1109
_FwdIt _Last
Definition: algorithm:1936
template<class _Traits>
size_type _Tree< _Traits >::erase ( const key_type _Keyval)
inline
1459  { // erase and count all that match _Keyval
1460  _Pairii _Where = equal_range(_Keyval);
1461  size_type _Num = _STD distance(_Where.first, _Where.second);
1462  erase(_Where.first, _Where.second);
1463  return (_Num);
1464  }
_Iter_diff_t< _InIt > distance(_InIt _First, _InIt _Last)
Definition: xutility:1124
_Pairii equal_range(const key_type &_Keyval)
Definition: xtree:1588
iterator erase(const_iterator _Where)
Definition: xtree:1258
pair< iterator, iterator > _Pairii
Definition: xtree:992
_Mybase::size_type size_type
Definition: xtree:976
template<class _Traits>
iterator _Tree< _Traits >::find ( const key_type _Keyval)
inline
1480  { // find an element in mutable sequence that matches _Keyval
1481  iterator _Where = lower_bound(_Keyval);
1482  return (_Where == end()
1483  || _DEBUG_LT_PRED(this->_Getcomp(),
1484  _Keyval, this->_Key(_Where._Mynode()))
1485  ? end() : _Where);
1486  }
key_compare & _Getcomp() _NOEXCEPT
Definition: xtree:898
iterator lower_bound(const key_type &_Keyval)
Definition: xtree:1536
#define _DEBUG_LT_PRED(pred, x, y)
Definition: xutility:817
Definition: xutility:563
iterator end() _NOEXCEPT
Definition: xtree:1119
const key_type & _Key(_Nodeptr _Pnode) const
Definition: xtree:2176
template<class _Traits>
const_iterator _Tree< _Traits >::find ( const key_type _Keyval) const
inline
1489  { // find an element in nonmutable sequence that matches _Keyval
1490  const_iterator _Where = lower_bound(_Keyval);
1491  return (_Where == end()
1492  || _DEBUG_LT_PRED(this->_Getcomp(),
1493  _Keyval, this->_Key(_Where._Mynode()))
1494  ? end() : _Where);
1495  }
key_compare & _Getcomp() _NOEXCEPT
Definition: xtree:898
iterator lower_bound(const key_type &_Keyval)
Definition: xtree:1536
#define _DEBUG_LT_PRED(pred, x, y)
Definition: xutility:817
_Mybase::const_iterator const_iterator
Definition: xtree:983
iterator end() _NOEXCEPT
Definition: xtree:1119
const key_type & _Key(_Nodeptr _Pnode) const
Definition: xtree:2176
template<class _Traits>
template<class _Other , class _Mycomp = key_compare, class = typename _Mycomp::is_transparent>
iterator _Tree< _Traits >::find ( const _Other &  _Keyval)
inline
1501  { // find an element in mutable sequence that matches _Keyval
1502  iterator _Where = lower_bound(_Keyval);
1503  return (_Where == end()
1504  || _DEBUG_LT_PRED(this->_Getcomp(),
1505  _Keyval, this->_Key(_Where._Mynode()))
1506  ? end() : _Where);
1507  }
key_compare & _Getcomp() _NOEXCEPT
Definition: xtree:898
iterator lower_bound(const key_type &_Keyval)
Definition: xtree:1536
#define _DEBUG_LT_PRED(pred, x, y)
Definition: xutility:817
Definition: xutility:563
iterator end() _NOEXCEPT
Definition: xtree:1119
const key_type & _Key(_Nodeptr _Pnode) const
Definition: xtree:2176
template<class _Traits>
template<class _Other , class _Mycomp = key_compare, class = typename _Mycomp::is_transparent>
const_iterator _Tree< _Traits >::find ( const _Other &  _Keyval) const
inline
1513  { // find an element in nonmutable sequence that matches _Keyval
1514  const_iterator _Where = lower_bound(_Keyval);
1515  return (_Where == end()
1516  || _DEBUG_LT_PRED(this->_Getcomp(),
1517  _Keyval, this->_Key(_Where._Mynode()))
1518  ? end() : _Where);
1519  }
key_compare & _Getcomp() _NOEXCEPT
Definition: xtree:898
iterator lower_bound(const key_type &_Keyval)
Definition: xtree:1536
#define _DEBUG_LT_PRED(pred, x, y)
Definition: xutility:817
_Mybase::const_iterator const_iterator
Definition: xtree:983
iterator end() _NOEXCEPT
Definition: xtree:1119
const key_type & _Key(_Nodeptr _Pnode) const
Definition: xtree:2176
template<class _Traits>
allocator_type _Tree< _Traits >::get_allocator ( ) const
inline
1185  { // return allocator object for values
1186  allocator_type _Ret(this->_Getal());
1187  return (_Ret);
1188  }
_Alty & _Getal() _NOEXCEPT
Definition: xtree:908
_Mybase::allocator_type allocator_type
Definition: xtree:973
template<class _Traits>
template<bool _Multi2 = _Multi, enable_if_t<!_Multi2, int > = 0>
_Pairib _Tree< _Traits >::insert ( const value_type _Val)
inline
1203  { // try to insert node with value _Val, favoring right side
1204  return (_Insert_nohint(false,
1205  _Val, _Nil()));
1206  }
_In_ int _Val
Definition: vcruntime_string.h:62
Definition: xtr1common:15
_Pairib _Insert_nohint(bool _Leftish, _Valty &&_Val, _Nodety _Newnode)
Definition: xtree:1769
template<class _Traits>
template<bool _Multi2 = _Multi, enable_if_t< _Multi2, int > = 0>
iterator _Tree< _Traits >::insert ( const value_type _Val)
inline
1211  { // try to insert node with value _Val, favoring right side
1212  return (_Insert_nohint(false,
1213  _Val, _Nil()).first);
1214  }
_In_ int _Val
Definition: vcruntime_string.h:62
Definition: xtr1common:15
_Pairib _Insert_nohint(bool _Leftish, _Valty &&_Val, _Nodety _Newnode)
Definition: xtree:1769
template<class _Traits>
template<bool _Multi2 = _Multi, enable_if_t<!_Multi2, int > = 0>
_Pairib _Tree< _Traits >::insert ( value_type &&  _Val)
inline
1219  { // try to insert node with value _Val, favoring right side
1220  return (_Insert_nohint(false,
1221  _STD forward<value_type>(_Val), _Nil()));
1222  }
_In_ int _Val
Definition: vcruntime_string.h:62
Definition: xtr1common:15
_Pairib _Insert_nohint(bool _Leftish, _Valty &&_Val, _Nodety _Newnode)
Definition: xtree:1769
template<class _Traits>
template<bool _Multi2 = _Multi, enable_if_t< _Multi2, int > = 0>
iterator _Tree< _Traits >::insert ( value_type &&  _Val)
inline
1227  { // try to insert node with value _Val, favoring right side
1228  return (_Insert_nohint(false,
1229  _STD forward<value_type>(_Val), _Nil()).first);
1230  }
_In_ int _Val
Definition: vcruntime_string.h:62
Definition: xtr1common:15
_Pairib _Insert_nohint(bool _Leftish, _Valty &&_Val, _Nodety _Newnode)
Definition: xtree:1769
template<class _Traits>
iterator _Tree< _Traits >::insert ( const_iterator  _Where,
const value_type _Val 
)
inline
1234  { // try to insert node with value _Val using _Where as a hint
1235  return (_Insert_hint(_Where,
1236  _Val, _Nil()));
1237  }
_In_ int _Val
Definition: vcruntime_string.h:62
iterator _Insert_hint(const_iterator _Where, _Valty &&_Val, _Nodety _Newnode)
Definition: xtree:1653
Definition: xtr1common:15
template<class _Traits>
iterator _Tree< _Traits >::insert ( const_iterator  _Where,
value_type &&  _Val 
)
inline
1240  { // try to insert node with value _Val using _Where as a hint
1241  return (_Insert_hint(_Where,
1242  _STD forward<value_type>(_Val), _Nil()));
1243  }
_In_ int _Val
Definition: vcruntime_string.h:62
iterator _Insert_hint(const_iterator _Where, _Valty &&_Val, _Nodety _Newnode)
Definition: xtree:1653
Definition: xtr1common:15
template<class _Traits>
template<class _Iter >
void _Tree< _Traits >::insert ( _Iter  _First,
_Iter  _Last 
)
inline
1247  { // insert [_First, _Last) one at a time
1248  _DEBUG_RANGE(_First, _Last);
1249  for (; _First != _Last; ++_First)
1250  emplace_hint(end(), *_First);
1251  }
iterator emplace_hint(const_iterator _Where, _Valty &&..._Val)
Definition: xtree:1082
#define _DEBUG_RANGE(first, last)
Definition: xutility:822
iterator end() _NOEXCEPT
Definition: xtree:1119
_FwdIt _Last
Definition: algorithm:1936
template<class _Traits>
void _Tree< _Traits >::insert ( _XSTD initializer_list< value_type _Ilist)
inline
1254  { // insert initializer_list
1255  insert(_Ilist.begin(), _Ilist.end());
1256  }
_Pairib insert(const value_type &_Val)
Definition: xtree:1202
template<class _Traits>
key_compare _Tree< _Traits >::key_comp ( ) const
inline
1191  { // return object for comparing keys
1192  return (this->_Getcomp());
1193  }
key_compare & _Getcomp() _NOEXCEPT
Definition: xtree:898
template<class _Traits>
iterator _Tree< _Traits >::lower_bound ( const key_type _Keyval)
inline
1537  { // find leftmost node not less than _Keyval in mutable tree
1538  return (iterator(_Lbound(_Keyval), &this->_Get_data()));
1539  }
_If< is_same< key_type, value_type >::value, typename _Mybase::const_iterator, typename _Mybase::iterator >::type iterator
Definition: xtree:986
_Tree_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: xtree:918
_Nodeptr _Lbound(const _Other &_Keyval) const
Definition: xtree:2058
template<class _Traits>
const_iterator _Tree< _Traits >::lower_bound ( const key_type _Keyval) const
inline
1542  { // find leftmost node not less than _Keyval in nonmutable tree
1543  return (const_iterator(_Lbound(_Keyval), &this->_Get_data()));
1544  }
_Mybase::const_iterator const_iterator
Definition: xtree:983
_Tree_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: xtree:918
_Nodeptr _Lbound(const _Other &_Keyval) const
Definition: xtree:2058
template<class _Traits>
template<class _Other , class _Mycomp = key_compare, class = typename _Mycomp::is_transparent>
iterator _Tree< _Traits >::lower_bound ( const _Other &  _Keyval)
inline
1550  { // find leftmost node not less than _Keyval in mutable tree
1551  return (iterator(_Lbound(_Keyval), &this->_Get_data()));
1552  }
_If< is_same< key_type, value_type >::value, typename _Mybase::const_iterator, typename _Mybase::iterator >::type iterator
Definition: xtree:986
_Tree_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: xtree:918
_Nodeptr _Lbound(const _Other &_Keyval) const
Definition: xtree:2058
template<class _Traits>
template<class _Other , class _Mycomp = key_compare, class = typename _Mycomp::is_transparent>
const_iterator _Tree< _Traits >::lower_bound ( const _Other &  _Keyval) const
inline
1558  { // find leftmost node not less than _Keyval in nonmutable tree
1559  return (const_iterator(_Lbound(_Keyval), &this->_Get_data()));
1560  }
_Mybase::const_iterator const_iterator
Definition: xtree:983
_Tree_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: xtree:918
_Nodeptr _Lbound(const _Other &_Keyval) const
Definition: xtree:2058
template<class _Traits>
size_type _Tree< _Traits >::max_size ( ) const
inline
1175  { // return maximum possible length of sequence
1176  return (this->_Getal().max_size());
1177  }
_Alty & _Getal() _NOEXCEPT
Definition: xtree:908
size_type max_size() const _NOEXCEPT
Definition: xtree:1174
template<class _Traits>
_Myt& _Tree< _Traits >::operator= ( _Myt &&  _Right)
inline
1038  { // assign by moving _Right
1039  if (this != &_Right)
1040  { // different, move it
1041  clear();
1042  if (_Alty::propagate_on_container_move_assignment::value
1043  && this->_Getal() != _Right._Getal())
1044  this->_Move_alloc(_Right._Getal());
1045 
1046  _Assign_rv(_STD forward<_Myt>(_Right));
1047  }
1048  return (*this);
1049  }
void _Assign_rv(_Myt &&_Right, true_type)
Definition: xtree:1051
void _Move_alloc(_Alty &_Al)
Definition: xtree:734
static _Nodepref _Right(_Nodeptr _Pnode)
Definition: xtree:681
_Alty & _Getal() _NOEXCEPT
Definition: xtree:908
void clear() _NOEXCEPT
Definition: xtree:1466
template<class _Traits>
_Myt& _Tree< _Traits >::operator= ( const _Myt _Right)
inline
1095  { // replace contents from _Right
1096  if (this != &_Right)
1097  { // different, assign it
1098  clear();
1099  if (this->_Getal() != _Right._Getal()
1100  && _Alty::propagate_on_container_copy_assignment::value)
1101  this->_Copy_alloc(_Right._Getal());
1102 
1103  this->_Getcomp() = _Right._Getcomp();
1104  _Copy(_Right, _Copy_tag());
1105  }
1106  return (*this);
1107  }
key_compare & _Getcomp() _NOEXCEPT
Definition: xtree:898
static _Nodepref _Right(_Nodeptr _Pnode)
Definition: xtree:681
_Alty & _Getal() _NOEXCEPT
Definition: xtree:908
void clear() _NOEXCEPT
Definition: xtree:1466
void _Copy(const _Myt &_Right, _Moveit _Movefl)
Definition: xtree:1919
void _Copy_alloc(const _Alty &_Al)
Definition: xtree:729
template<class _Traits>
reverse_iterator _Tree< _Traits >::rbegin ( )
inline
1130  { // return iterator for beginning of reversed mutable sequence
1131  return (reverse_iterator(end()));
1132  }
iterator end() _NOEXCEPT
Definition: xtree:1119
_STD reverse_iterator< iterator > reverse_iterator
Definition: xtree:988
template<class _Traits>
const_reverse_iterator _Tree< _Traits >::rbegin ( ) const
inline
1135  { // return iterator for beginning of reversed nonmutable sequence
1136  return (const_reverse_iterator(end()));
1137  }
iterator end() _NOEXCEPT
Definition: xtree:1119
_STD reverse_iterator< const_iterator > const_reverse_iterator
Definition: xtree:989
template<class _Traits>
reverse_iterator _Tree< _Traits >::rend ( )
inline
1140  { // return iterator for end of reversed mutable sequence
1141  return (reverse_iterator(begin()));
1142  }
iterator begin() _NOEXCEPT
Definition: xtree:1109
_STD reverse_iterator< iterator > reverse_iterator
Definition: xtree:988
template<class _Traits>
const_reverse_iterator _Tree< _Traits >::rend ( ) const
inline
1145  { // return iterator for end of reversed nonmutable sequence
1146  return (const_reverse_iterator(begin()));
1147  }
iterator begin() _NOEXCEPT
Definition: xtree:1109
_STD reverse_iterator< const_iterator > const_reverse_iterator
Definition: xtree:989
template<class _Traits>
size_type _Tree< _Traits >::size ( ) const
inline
1170  { // return length of sequence
1171  return (this->_Mysize());
1172  }
size_type & _Mysize() _NOEXCEPT
Definition: xtree:938
template<class _Traits>
void _Tree< _Traits >::swap ( _Myt _Right)
inline
1615  { // exchange contents with _Right
1616  if (this != &_Right)
1617  { // (maybe) swap allocators, swap control information
1618  _Pocs(this->_Getal(), _Right._Getal());
1619  this->_Swap_all(_Right);
1620  _Swap_adl(this->_Getcomp(), _Right._Getcomp());
1621  _Swap_adl(this->_Myhead(), _Right._Myhead());
1622  _STD swap(this->_Mysize(), _Right._Mysize());
1623  }
1624  }
void _Swap_all(_Myt &_Right)
Definition: xtree:811
key_compare & _Getcomp() _NOEXCEPT
Definition: xtree:898
_Nodeptr & _Myhead() _NOEXCEPT
Definition: xtree:928
static _Nodepref _Right(_Nodeptr _Pnode)
Definition: xtree:681
size_type & _Mysize() _NOEXCEPT
Definition: xtree:938
void swap(_Myt &_Right)
Definition: xtree:1614
_Alty & _Getal() _NOEXCEPT
Definition: xtree:908
void _Swap_adl(_Ty &_Left, _Ty &_Right) _NOEXCEPT_OP(_Is_nothrow_swappable< _Ty >
Definition: utility:56
void _Pocs(_Alty &_Left, _Alty &_Right, true_type) _NOEXCEPT
Definition: xmemory0:1069
template<class _Traits>
iterator _Tree< _Traits >::upper_bound ( const key_type _Keyval)
inline
1563  { // find leftmost node greater than _Keyval in mutable tree
1564  return (iterator(_Ubound(_Keyval), &this->_Get_data()));
1565  }
_Nodeptr _Ubound(const _Other &_Keyval) const
Definition: xtree:2131
_If< is_same< key_type, value_type >::value, typename _Mybase::const_iterator, typename _Mybase::iterator >::type iterator
Definition: xtree:986
_Tree_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: xtree:918
template<class _Traits>
const_iterator _Tree< _Traits >::upper_bound ( const key_type _Keyval) const
inline
1568  { // find leftmost node greater than _Keyval in nonmutable tree
1569  return (const_iterator(_Ubound(_Keyval), &this->_Get_data()));
1570  }
_Nodeptr _Ubound(const _Other &_Keyval) const
Definition: xtree:2131
_Mybase::const_iterator const_iterator
Definition: xtree:983
_Tree_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: xtree:918
template<class _Traits>
template<class _Other , class _Mycomp = key_compare, class = typename _Mycomp::is_transparent>
iterator _Tree< _Traits >::upper_bound ( const _Other &  _Keyval)
inline
1576  { // find leftmost node greater than _Keyval in mutable tree
1577  return (iterator(_Ubound(_Keyval), &this->_Get_data()));
1578  }
_Nodeptr _Ubound(const _Other &_Keyval) const
Definition: xtree:2131
_If< is_same< key_type, value_type >::value, typename _Mybase::const_iterator, typename _Mybase::iterator >::type iterator
Definition: xtree:986
_Tree_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: xtree:918
template<class _Traits>
template<class _Other , class _Mycomp = key_compare, class = typename _Mycomp::is_transparent>
const_iterator _Tree< _Traits >::upper_bound ( const _Other &  _Keyval) const
inline
1584  { // find leftmost node greater than _Keyval in nonmutable tree
1585  return (const_iterator(_Ubound(_Keyval), &this->_Get_data()));
1586  }
_Nodeptr _Ubound(const _Other &_Keyval) const
Definition: xtree:2131
_Mybase::const_iterator const_iterator
Definition: xtree:983
_Tree_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: xtree:918
template<class _Traits>
value_compare _Tree< _Traits >::value_comp ( ) const
inline
1196  { // return object for comparing values
1197  return (value_compare(key_comp()));
1198  }
_Traits::value_compare value_compare
Definition: xtree:963
key_compare key_comp() const
Definition: xtree:1190

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