STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Private Attributes | List of all members
cliext::impl::tree< _Traits_t > Class Template Reference
Inheritance diagram for cliext::impl::tree< _Traits_t >:

Public Types

typedef tree< _Traits_t > _Mytype_t
 
typedef _Traits_t _Mybase_t
 
typedef _Traits_t::key_type _Key_t
 
typedef _Traits_t::value_type _Value_t
 
typedef _STLCLR ITree< _Key_t, _Value_t_Mycont_it
 
typedef System::Collections::Generic::IEnumerable< _Value_t_Myenum_it
 
typedef cli::array< _Value_t_Myarray_t
 
typedef tree_node< _Key_t, _Value_tnode_type
 
typedef BidirectionalIterator< _Mytype_titerator
 
typedef ConstBidirectionalIterator< _Mytype_tconst_iterator
 
typedef ReverseBidirectionalIterator< _Mytype_treverse_iterator
 
typedef ReverseBidirectionalIterator< _Mytype_tconst_reverse_iterator
 
typedef _Traits_t::key_type key_type
 
typedef _Traits_t::value_type value_type
 
typedef _Traits_t::key_compare key_compare
 
typedef _Traits_t::value_compare value_compare
 
typedef int size_type
 
typedef int difference_type
 
typedef value_type reference
 
typedef value_type const_reference
 
typedef _Mycont_it generic_container
 
typedef value_type generic_value
 
typedef _STLCLR Generic::ContainerBidirectionalIterator< _Value_tgeneric_iterator
 
typedef _STLCLR Generic::ReverseBidirectionalIterator< _Value_tgeneric_reverse_iterator
 
typedef _STLCLR GenericPair< iterator, boolpair_iter_bool
 
typedef _STLCLR GenericPair< iterator, iteratorpair_iter_iter
 
typedef _STLCLR GenericPair< node_type^, bool_Pairnb
 
typedef _STLCLR GenericPair< node_type^, node_type^> _Pairnn
 
typedef _STLCLR GenericPair< generic_iterator^, boolgeneric_pair_iter_bool
 
typedef _STLCLR GenericPair< generic_iterator^, generic_iterator^> generic_pair_iter_iter
 

Public Member Functions

 tree ()
 
 tree (tree%_Right)
 
tree operator= (tree%_Right)
 
 operator _Mycont_it^ ()
 
 tree (key_compare^_Pred)
 
 ~tree ()
 
unsigned long get_generation ()
 
node_type get_node (iterator _Where)
 
node_type front_node ()
 
node_type back_node ()
 
node_type root_node ()
 
node_type head_node ()
 
_Myarray_t to_array ()
 
key_compare key_comp () new
 
value_compare value_comp () new
 
iterator make_iterator (node_type^_Node)
 
iterator begin ()
 
iterator end ()
 
reverse_iterator rbegin ()
 
reverse_iterator rend ()
 
size_type size ()
 
bool empty ()
 
pair_iter_bool insert (value_type _Val)
 
iterator insert (iterator _Where, value_type _Val)
 
template<typename _Iter_t >
void insert (_Iter_t _First, _Iter_t _Last)
 
void insert (_STLCLR Generic::IInputIterator< _Value_t >^_First, _STLCLR Generic::IInputIterator< _Value_t >^_Last)
 
void insert (_Myenum_it^_Right)
 
void insert_iter (_STLCLR Generic::IInputIterator< _Value_t >^_First, _STLCLR Generic::IInputIterator< _Value_t >^_Last)
 
_Pairnb insert_node (value_type _Val)
 
node_type insert_node (node_type^_Where_node, value_type _Val)
 
iterator erase (iterator _Where)
 
iterator erase (iterator _First, iterator _Last)
 
size_type erase (key_type _Keyval)
 
node_type erase_node (node_type^_Where_node)
 
void clear ()
 
void swap (_Mytype_t%_Right)
 
iterator find (key_type _Keyval)
 
size_type count (key_type _Keyval)
 
iterator lower_bound (key_type _Keyval)
 
node_type lower_bound_node (key_type _Keyval)
 
iterator upper_bound (key_type _Keyval)
 
node_type upper_bound_node (key_type _Keyval)
 
pair_iter_iter equal_range (key_type _Keyval)
 
_Pairnn equal_range_node (key_type _Keyval)
 
 return (_Node)
 
node_type _Buynode (node_type^_Larg, node_type^_Parg, node_type^_Rarg, value_type _Val, signed char _Carg)
 
void _Chown (node_type^_Node, node_type^_Head, tree^_Owner)
 
void _Copy (tree^_Right)
 
node_type _Copy (node_type^_Oldroot, node_type^_Newparent)
 
void _Init ()
 
node_type _Insert_node (bool _Addleft, node_type^_Where, value_type _Val)
 
key_type _Key (node_type^_Where)
 
void _Lrotate (node_type^_Where)
 
void _Rrotate (node_type^_Where)
 
virtual System::Object Clone ()
 

Public Attributes

_STLCLR_FIELD_ACCESS __pad0__: node_type^ _Buynode() { node_type^ _Node = gcnew node_type
 
_Node _Left = _Node
 
_Node _Parent = _Node
 
_Node _Right = _Node
 
_Node _Head = _Node
 
_Node _Color = _Black
 
_Node _Mycont = this
 
node_type _Myhead
 
size_type _Mysize
 
unsigned long _Mygen
 

Static Public Attributes

static const int _Maxsize = MAX_CONTAINER_SIZE
 
static const int _Black = 0
 
static const int _Red = 1
 

Private Attributes

property size_type Count
 
property bool IsSynchronized
 
property System::Object SyncRoot
 

Member Typedef Documentation

template<typename _Traits_t>
typedef _Traits_t::key_type cliext::impl::tree< _Traits_t >::_Key_t
template<typename _Traits_t>
typedef cli::array<_Value_t> cliext::impl::tree< _Traits_t >::_Myarray_t
template<typename _Traits_t>
typedef _Traits_t cliext::impl::tree< _Traits_t >::_Mybase_t
template<typename _Traits_t>
typedef _STLCLR ITree<_Key_t, _Value_t> cliext::impl::tree< _Traits_t >::_Mycont_it
template<typename _Traits_t>
typedef System::Collections::Generic::IEnumerable<_Value_t> cliext::impl::tree< _Traits_t >::_Myenum_it
template<typename _Traits_t>
typedef tree<_Traits_t> cliext::impl::tree< _Traits_t >::_Mytype_t
template<typename _Traits_t>
typedef _STLCLR GenericPair<node_type^, bool> cliext::impl::tree< _Traits_t >::_Pairnb
template<typename _Traits_t>
typedef _STLCLR GenericPair<node_type^, node_type^> cliext::impl::tree< _Traits_t >::_Pairnn
template<typename _Traits_t>
typedef _Traits_t::value_type cliext::impl::tree< _Traits_t >::_Value_t
template<typename _Traits_t>
typedef ConstBidirectionalIterator<_Mytype_t> cliext::impl::tree< _Traits_t >::const_iterator
template<typename _Traits_t>
typedef value_type cliext::impl::tree< _Traits_t >::const_reference
template<typename _Traits_t>
typedef ReverseBidirectionalIterator<_Mytype_t> cliext::impl::tree< _Traits_t >::const_reverse_iterator
template<typename _Traits_t>
typedef int cliext::impl::tree< _Traits_t >::difference_type
template<typename _Traits_t>
typedef _Mycont_it cliext::impl::tree< _Traits_t >::generic_container
template<typename _Traits_t>
typedef _STLCLR Generic::ContainerBidirectionalIterator<_Value_t> cliext::impl::tree< _Traits_t >::generic_iterator
template<typename _Traits_t>
typedef _STLCLR GenericPair<generic_iterator^, bool> cliext::impl::tree< _Traits_t >::generic_pair_iter_bool
template<typename _Traits_t>
typedef _STLCLR GenericPair<generic_iterator^, generic_iterator^> cliext::impl::tree< _Traits_t >::generic_pair_iter_iter
template<typename _Traits_t>
typedef _STLCLR Generic::ReverseBidirectionalIterator<_Value_t> cliext::impl::tree< _Traits_t >::generic_reverse_iterator
template<typename _Traits_t>
typedef value_type cliext::impl::tree< _Traits_t >::generic_value
template<typename _Traits_t>
typedef BidirectionalIterator<_Mytype_t> cliext::impl::tree< _Traits_t >::iterator
template<typename _Traits_t>
typedef _Traits_t::key_compare cliext::impl::tree< _Traits_t >::key_compare
template<typename _Traits_t>
typedef _Traits_t::key_type cliext::impl::tree< _Traits_t >::key_type
template<typename _Traits_t>
typedef tree_node<_Key_t, _Value_t> cliext::impl::tree< _Traits_t >::node_type
template<typename _Traits_t>
typedef _STLCLR GenericPair<iterator, bool> cliext::impl::tree< _Traits_t >::pair_iter_bool
template<typename _Traits_t>
typedef _STLCLR GenericPair<iterator, iterator> cliext::impl::tree< _Traits_t >::pair_iter_iter
template<typename _Traits_t>
typedef value_type cliext::impl::tree< _Traits_t >::reference
template<typename _Traits_t>
typedef ReverseBidirectionalIterator<_Mytype_t> cliext::impl::tree< _Traits_t >::reverse_iterator
template<typename _Traits_t>
typedef int cliext::impl::tree< _Traits_t >::size_type
template<typename _Traits_t>
typedef _Traits_t::value_compare cliext::impl::tree< _Traits_t >::value_compare
template<typename _Traits_t>
typedef _Traits_t::value_type cliext::impl::tree< _Traits_t >::value_type

Constructor & Destructor Documentation

template<typename _Traits_t>
cliext::impl::tree< _Traits_t >::tree ( )
inline
239  { // construct empty tree from default comparator
240  _Init();
241  }
void _Init()
Definition: xtree:977
template<typename _Traits_t>
cliext::impl::tree< _Traits_t >::tree ( tree< _Traits_t >%  _Right)
inline
244  : _Mybase_t(_Right.key_comp())
245  { // construct by copying _Right
246  _Init();
247  _Copy(%_Right);
248  }
void _Copy(tree^_Right)
Definition: xtree:941
void _Init()
Definition: xtree:977
_Node _Right
Definition: xtree:907
_Traits_t _Mybase_t
Definition: xtree:185
template<typename _Traits_t>
cliext::impl::tree< _Traits_t >::tree ( key_compare _Pred)
inlineexplicit
267  : _Mybase_t(_Pred)
268  { // construct empty tree from comparator
269  _Init();
270  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
void _Init()
Definition: xtree:977
_Traits_t _Mybase_t
Definition: xtree:185
template<typename _Traits_t>
cliext::impl::tree< _Traits_t >::~tree ( )
inline
274  { // destroy the object
275  clear();
276  _Myhead->_Mycont = nullptr; // orphan all iterators
277  _Myhead = nullptr;
278  _Mysize = 0;
279  ++_Mygen;
280  }
void clear()
Definition: xtree:805
unsigned long _Mygen
Definition: xtree:1114
node_type _Myhead
Definition: xtree:1112
_Mycont_it _Mycont
Definition: xtree:125
size_type _Mysize
Definition: xtree:1113

Member Function Documentation

template<typename _Traits_t>
node_type cliext::impl::tree< _Traits_t >::_Buynode ( node_type _Larg,
node_type _Parg,
node_type _Rarg,
value_type  _Val,
signed char  _Carg 
)
inline
916  { // allocate a node and set links
917  node_type^ _Node = gcnew node_type(
918  _Larg, _Parg, _Rarg, _Myhead, _Val, _Carg);
919 
920  return (_Node);
921  }
tree_node< _Key_t, _Value_t > node_type
Definition: xtree:192
node_type _Myhead
Definition: xtree:1112
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<typename _Traits_t>
void cliext::impl::tree< _Traits_t >::_Chown ( node_type _Node,
node_type _Head,
tree< _Traits_t >^  _Owner 
)
inline
924  { // change ownership of subtree
925  if (_Node->_Left->is_head())
926  _Node->_Left = _Head;
927  else
928  _Chown(_Node->_Left, _Head, _Owner);
929 
930  if (_Node->_Right->is_head())
931  _Node->_Right = _Head;
932  else
933  _Chown(_Node->_Right, _Head, _Owner);
934 
935  if (_Node->is_head())
936  _Node->_Parent = _Head;
937 
938  _Node->_Mycont = _Owner;
939  }
void _Chown(node_type^_Node, node_type^_Head, tree^_Owner)
Definition: xtree:923
_Node _Head
Definition: xtree:908
template<typename _Traits_t>
void cliext::impl::tree< _Traits_t >::_Copy ( tree< _Traits_t >^  _Right)
inline
942  { // copy entire tree from _Right
943  _Myhead->_Parent = _Copy(_Right->root_node(), head_node());
944  _Mysize = _Right->size();
945  if (!root_node()->is_head())
946  { // nonempty tree, look for new smallest and largest
947  head_node()->_Left = root_node()->min_node();
949  }
950  else
951  { // empty tree, cauterize smallest and largest
952  head_node()->_Left = head_node();
953  head_node()->_Right = head_node();
954  }
955  ++_Mygen;
956  }
unsigned long _Mygen
Definition: xtree:1114
_Mytype_t _Right
Definition: xtree:129
void _Copy(tree^_Right)
Definition: xtree:941
_Mytype_t min_node()
Definition: xtree:55
node_type head_node()
Definition: xtree:312
node_type _Myhead
Definition: xtree:1112
_Mytype_t _Parent
Definition: xtree:128
_Mytype_t _Left
Definition: xtree:127
node_type root_node()
Definition: xtree:307
_Node _Right
Definition: xtree:907
_Mytype_t max_node()
Definition: xtree:46
size_type _Mysize
Definition: xtree:1113
template<typename _Traits_t>
node_type cliext::impl::tree< _Traits_t >::_Copy ( node_type _Oldroot,
node_type _Newparent 
)
inline
960  { // copy entire subtree, recursively
961  node_type^ _Newroot = head_node();
962 
963  if (!_Oldroot->is_head())
964  { // copy a node, then any subtrees
965  node_type^ _Node = _Buynode(head_node(), _Newparent,
966  head_node(), _Oldroot->_Myval, _Oldroot->_Color);
967 
968  if (_Newroot->is_head())
969  _Newroot = _Node; // memorize new root first time
970 
971  _Node->_Left = _Copy(_Oldroot->_Left, _Node);
972  _Node->_Right = _Copy(_Oldroot->_Right, _Node);
973  }
974  return (_Newroot);
975  }
void _Copy(tree^_Right)
Definition: xtree:941
tree_node< _Key_t, _Value_t > node_type
Definition: xtree:192
value_type _Myval
Definition: xtree:130
node_type _Buynode(node_type^_Larg, node_type^_Parg, node_type^_Rarg, value_type _Val, signed char _Carg)
Definition: xtree:914
node_type head_node()
Definition: xtree:312
template<typename _Traits_t>
void cliext::impl::tree< _Traits_t >::_Init ( )
inline
978  { // create header/nil node and make tree empty
979  _Mysize = 0;
980  _Myhead = _Buynode();
981  _Mygen = 0;
982  }
unsigned long _Mygen
Definition: xtree:1114
node_type _Buynode(node_type^_Larg, node_type^_Parg, node_type^_Rarg, value_type _Val, signed char _Carg)
Definition: xtree:914
node_type _Myhead
Definition: xtree:1112
size_type _Mysize
Definition: xtree:1113
template<typename _Traits_t>
node_type cliext::impl::tree< _Traits_t >::_Insert_node ( bool  _Addleft,
node_type _Where,
value_type  _Val 
)
inline
986  { // add node with value next to _Where, to left if _Addleft
987 
988  if (_Maxsize <= _Mysize)
989  throw gcnew System::InvalidOperationException();
990 
991  node_type^ _Newnode = _Buynode(head_node(), _Where, head_node(),
992  _Val, _Red);
993 
994  if (_Where == head_node())
995  { // first node in tree, just set head values
996  head_node()->_Left = _Newnode;
997  head_node()->_Parent = _Newnode;
998  head_node()->_Right = _Newnode;
999  }
1000  else if (_Addleft)
1001  { // add to left of _Where
1002  _Where->_Left = _Newnode;
1003  if (_Where == front_node())
1004  head_node()->_Left = _Newnode;
1005  }
1006  else
1007  { // add to right of _Where
1008  _Where->_Right = _Newnode;
1009  if (_Where == back_node())
1010  head_node()->_Right = _Newnode;
1011  }
1012 
1013  for (node_type^ _Node = _Newnode;
1014  _Node->_Parent->_Color == _Red; )
1015  if (_Node->_Parent == _Node->_Parent->_Parent->_Left)
1016  { // fixup red-red in left subtree
1017  _Where = _Node->_Parent->_Parent->_Right;
1018  if (_Where->_Color == _Red)
1019  { // parent has two red children, blacken both
1020  _Node->_Parent->_Color = _Black;
1021  _Where->_Color = _Black;
1022  _Node->_Parent->_Parent->_Color = _Red;
1023  _Node = _Node->_Parent->_Parent;
1024  }
1025  else
1026  { // parent has red and black children
1027  if (_Node == _Node->_Parent->_Right)
1028  { // rotate right child to left
1029  _Node = _Node->_Parent;
1030  _Lrotate(_Node);
1031  }
1032  _Node->_Parent->_Color = _Black; // propagate red up
1033  _Node->_Parent->_Parent->_Color = _Red;
1034  _Rrotate(_Node->_Parent->_Parent);
1035  }
1036  }
1037  else
1038  { // fixup red-red in right subtree
1039  _Where = _Node->_Parent->_Parent->_Left;
1040  if (_Where->_Color == _Red)
1041  { // parent has two red children, blacken both
1042  _Node->_Parent->_Color = _Black;
1043  _Where->_Color = _Black;
1044  _Node->_Parent->_Parent->_Color = _Red;
1045  _Node = _Node->_Parent->_Parent;
1046  }
1047  else
1048  { // parent has red and black children
1049  if (_Node == _Node->_Parent->_Left)
1050  { // rotate left child to right
1051  _Node = _Node->_Parent;
1052  _Rrotate(_Node);
1053  }
1054  _Node->_Parent->_Color = _Black; // propagate red up
1055  _Node->_Parent->_Parent->_Color = _Red;
1056  _Lrotate(_Node->_Parent->_Parent);
1057  }
1058  }
1059 
1060  root_node()->_Color = _Black; // root is always black
1061  ++_Mysize;
1062  ++_Mygen;
1063  return (_Newnode);
1064  }
unsigned long _Mygen
Definition: xtree:1114
_Mytype_t _Right
Definition: xtree:129
signed char _Color
Definition: xtree:131
static const int _Maxsize
Definition: xtree:232
tree_node< _Key_t, _Value_t > node_type
Definition: xtree:192
node_type back_node()
Definition: xtree:302
_Node _Left
Definition: xtree:905
node_type _Buynode(node_type^_Larg, node_type^_Parg, node_type^_Rarg, value_type _Val, signed char _Carg)
Definition: xtree:914
node_type head_node()
Definition: xtree:312
node_type front_node()
Definition: xtree:297
void _Lrotate(node_type^_Where)
Definition: xtree:1071
_Mytype_t _Parent
Definition: xtree:128
_Mytype_t _Left
Definition: xtree:127
node_type root_node()
Definition: xtree:307
_Node _Right
Definition: xtree:907
_Node _Parent
Definition: xtree:906
void _Rrotate(node_type^_Where)
Definition: xtree:1091
static const int _Red
Definition: xtree:235
static const int _Black
Definition: xtree:234
size_type _Mysize
Definition: xtree:1113
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<typename _Traits_t>
key_type cliext::impl::tree< _Traits_t >::_Key ( node_type _Where)
inline
1067  { // get key value from node
1068  return (this->get_key(_Where->_Myval));
1069  }
template<typename _Traits_t>
void cliext::impl::tree< _Traits_t >::_Lrotate ( node_type _Where)
inline
1072  { // promote right node to root of subtree
1073  node_type^ _Node = _Where->_Right;
1074  _Where->_Right = _Node->_Left;
1075 
1076  if (!_Node->_Left->is_head())
1077  _Node->_Left->_Parent = _Where;
1078  _Node->_Parent = _Where->_Parent;
1079 
1080  if (_Where == root_node())
1081  head_node()->_Parent = _Node;
1082  else if (_Where == _Where->_Parent->_Left)
1083  _Where->_Parent->_Left = _Node;
1084  else
1085  _Where->_Parent->_Right = _Node;
1086 
1087  _Node->_Left = _Where;
1088  _Where->_Parent = _Node;
1089  }
tree_node< _Key_t, _Value_t > node_type
Definition: xtree:192
node_type head_node()
Definition: xtree:312
_Mytype_t _Parent
Definition: xtree:128
node_type root_node()
Definition: xtree:307
_Node _Parent
Definition: xtree:906
if(__pUnknown!=*__ppTargetUnknown)
Definition: vccorlib.h:399
template<typename _Traits_t>
void cliext::impl::tree< _Traits_t >::_Rrotate ( node_type _Where)
inline
1092  { // promote left node to root of subtree
1093  node_type^ _Node = _Where->_Left;
1094  _Where->_Left = _Node->_Right;
1095 
1096  if (!_Node->_Right->is_head())
1097  _Node->_Right->_Parent = _Where;
1098  _Node->_Parent = _Where->_Parent;
1099 
1100  if (_Where == root_node())
1101  head_node()->_Parent = _Node;
1102  else if (_Where == _Where->_Parent->_Right)
1103  _Where->_Parent->_Right = _Node;
1104  else
1105  _Where->_Parent->_Left = _Node;
1106 
1107  _Node->_Right = _Where;
1108  _Where->_Parent = _Node;
1109  }
tree_node< _Key_t, _Value_t > node_type
Definition: xtree:192
node_type head_node()
Definition: xtree:312
_Mytype_t _Parent
Definition: xtree:128
node_type root_node()
Definition: xtree:307
_Node _Parent
Definition: xtree:906
if(__pUnknown!=*__ppTargetUnknown)
Definition: vccorlib.h:399
template<typename _Traits_t>
node_type cliext::impl::tree< _Traits_t >::back_node ( )
inline
303  { // return rightmost node in tree
304  return (head_node()->_Right);
305  }
node_type head_node()
Definition: xtree:312
_Node _Right
Definition: xtree:907
template<typename _Traits_t>
iterator cliext::impl::tree< _Traits_t >::begin ( )
inline
354  { // return iterator for beginning of mutable sequence
355  return (make_iterator(front_node()));
356  }
iterator make_iterator(node_type^_Node)
Definition: xtree:348
node_type front_node()
Definition: xtree:297
template<typename _Traits_t>
void cliext::impl::tree< _Traits_t >::clear ( )
inline
806  { // erase all
807  for (; front_node() != head_node(); )
809  }
node_type head_node()
Definition: xtree:312
node_type front_node()
Definition: xtree:297
node_type erase_node(node_type^_Where_node)
Definition: xtree:643
template<typename _Traits_t>
virtual System::Object cliext::impl::tree< _Traits_t >::Clone ( )
inlinevirtual

Reimplemented in cliext::multimap< _Key1_t, _Mapped_t >, cliext::map< _Key1_t, _Mapped_t >, cliext::multiset< _Key1_t >, and cliext::set< _Key1_t >.

1119  { // clone the tree
1120  return (gcnew tree(*this));
1121  }
tree()
Definition: xtree:238
template<typename _Traits_t>
size_type cliext::impl::tree< _Traits_t >::count ( key_type  _Keyval)
inline
833  { // count all elements that match _Keyval
834  node_type^ _First = lower_bound_node(_Keyval);
835  node_type^ _Last = upper_bound_node(_Keyval);
836  size_type _Num = 0;
837 
838  for (; _First != _Last; _First = _First->next_node())
839  ++_Num;
840  return (_Num);
841  }
node_type lower_bound_node(key_type _Keyval)
Definition: xtree:848
int size_type
Definition: xtree:208
tree_node< _Key_t, _Value_t > node_type
Definition: xtree:192
_FwdIt _Last
Definition: algorithm:1936
node_type upper_bound_node(key_type _Keyval)
Definition: xtree:870
template<typename _Traits_t>
bool cliext::impl::tree< _Traits_t >::empty ( )
inline
385  { // test if sequence is empty
386  return (size() == 0);
387  }
size_type size()
Definition: xtree:379
template<typename _Traits_t>
iterator cliext::impl::tree< _Traits_t >::end ( )
inline
359  { // return iterator for end of mutable sequence
360  return (make_iterator(head_node()));
361  }
iterator make_iterator(node_type^_Node)
Definition: xtree:348
node_type head_node()
Definition: xtree:312
template<typename _Traits_t>
pair_iter_iter cliext::impl::tree< _Traits_t >::equal_range ( key_type  _Keyval)
inline
888  { // find range equivalent to _Keyval
889  _Pairnn _Ans = equal_range_node(_Keyval);
890  return (pair_iter_iter(iterator(_Ans.first),
891  iterator(_Ans.second)));
892  }
Definition: xutility:563
BidirectionalIterator< _Mytype_t > iterator
Definition: xtree:195
_Pairnn equal_range_node(key_type _Keyval)
Definition: xtree:894
_STLCLR GenericPair< iterator, iterator > pair_iter_iter
Definition: xtree:222
_STLCLR GenericPair< node_type^, node_type^> _Pairnn
Definition: xtree:224
template<typename _Traits_t>
_Pairnn cliext::impl::tree< _Traits_t >::equal_range_node ( key_type  _Keyval)
inline
895  { // find range equivalent to _Keyval
896  return (_Pairnn(lower_bound_node(_Keyval),
897  upper_bound_node(_Keyval)));
898  }
node_type lower_bound_node(key_type _Keyval)
Definition: xtree:848
_STLCLR GenericPair< node_type^, node_type^> _Pairnn
Definition: xtree:224
node_type upper_bound_node(key_type _Keyval)
Definition: xtree:870
template<typename _Traits_t>
iterator cliext::impl::tree< _Traits_t >::erase ( iterator  _Where)
inline
615  { // erase element at _Where
616  return (make_iterator(erase_node(get_node(_Where))));
617  }
iterator make_iterator(node_type^_Node)
Definition: xtree:348
node_type get_node(iterator _Where)
Definition: xtree:288
node_type erase_node(node_type^_Where_node)
Definition: xtree:643
template<typename _Traits_t>
iterator cliext::impl::tree< _Traits_t >::erase ( iterator  _First,
iterator  _Last 
)
inline
620  { // erase [_First, _Last)
621  node_type^ _First_node = get_node(_First);
622  node_type^ _Last_node = get_node(_Last);
623 
624  if (_First_node == front_node() && _Last_node == head_node())
625  clear(); // erase all
626  else
627  for (; _First_node != _Last_node; )
628  _First_node = erase_node(_First_node);
629  return (_Last);
630  }
void clear()
Definition: xtree:805
tree_node< _Key_t, _Value_t > node_type
Definition: xtree:192
node_type head_node()
Definition: xtree:312
node_type front_node()
Definition: xtree:297
node_type get_node(iterator _Where)
Definition: xtree:288
node_type erase_node(node_type^_Where_node)
Definition: xtree:643
template<typename _Traits_t>
size_type cliext::impl::tree< _Traits_t >::erase ( key_type  _Keyval)
inline
633  { // erase and count all that match _Keyval
634  node_type^ _First = lower_bound_node(_Keyval);
635  node_type^ _Last = upper_bound_node(_Keyval);
636  size_type _Num = 0;
637 
638  for (; _First != _Last; ++_Num)
639  _First = erase_node(_First); // erase an element matching key
640  return (_Num);
641  }
node_type lower_bound_node(key_type _Keyval)
Definition: xtree:848
int size_type
Definition: xtree:208
tree_node< _Key_t, _Value_t > node_type
Definition: xtree:192
node_type erase_node(node_type^_Where_node)
Definition: xtree:643
_FwdIt _Last
Definition: algorithm:1936
node_type upper_bound_node(key_type _Keyval)
Definition: xtree:870
template<typename _Traits_t>
node_type cliext::impl::tree< _Traits_t >::erase_node ( node_type _Where_node)
inline
644  { // erase node _Where
645  node_type^ _Where = (node_type^)_Where_node;
646  node_type^ _Next = _Where->next_node(); // for return value
647  node_type^ _Fixnode; // the node to recolor as needed
648  node_type^ _Fixnodeparent; // parent of _Fixnode (may be nil)
649  node_type^ _Node = _Where; // the node to erase
650 
651  if (_Where->container() != this)
652  throw gcnew System::InvalidOperationException();
653 
654  if (_Node->_Left->is_head())
655  _Fixnode = _Node->_Right; // must stitch up right subtree
656  else if (_Node->_Right->is_head())
657  _Fixnode = _Node->_Left; // must stitch up left subtree
658  else
659  { // two subtrees, must lift successor node to replace erased
660  _Node = _Next; // _Node is successor node
661  _Fixnode = _Node->_Right; // _Fixnode is its only subtree
662  }
663 
664  if (_Node == _Where)
665  { // at most one subtree, relink it
666  _Fixnodeparent = _Where->_Parent;
667  if (!_Fixnode->is_head())
668  _Fixnode->_Parent = _Fixnodeparent; // link up
669 
670  if (root_node() == _Where)
671  head_node()->_Parent = _Fixnode; // link down from root
672  else if (_Fixnodeparent->_Left == _Where)
673  _Fixnodeparent->_Left = _Fixnode; // link down to left
674  else
675  _Fixnodeparent->_Right = _Fixnode; // link down to right
676 
677  if (front_node() == _Where)
678  head_node()->_Left = _Fixnode->is_head()
679  ? _Fixnodeparent // smallest is parent of erased node
680  : _Fixnode->min_node(); // smallest in relinked subtree
681 
682  if (back_node() == _Where)
683  head_node()->_Right = _Fixnode->is_head()
684  ? _Fixnodeparent // largest is parent of erased node
685  : _Fixnode->max_node(); // largest in relinked subtree
686  }
687  else
688  { // erased has two subtrees, _Node is successor to erased
689  _Where->_Left->_Parent = _Node; // link left up
690  _Node->_Left = _Where->_Left; // link successor down
691 
692  if (_Node == _Where->_Right)
693  _Fixnodeparent = _Node; // successor is next to erased
694  else
695  { // successor further down, link in place of erased
696  _Fixnodeparent = _Node->_Parent; // parent is successor's
697  if (!_Fixnode->is_head())
698  _Fixnode->_Parent = _Fixnodeparent; // link fix up
699  _Fixnodeparent->_Left = _Fixnode; // link fix down
700  _Node->_Right = _Where->_Right; // link successor down
701  _Where->_Right->_Parent = _Node; // link right up
702  }
703 
704  if (root_node() == _Where)
705  head_node()->_Parent = _Node; // link down from root
706  else if (_Where->_Parent->_Left == _Where)
707  _Where->_Parent->_Left = _Node; // link down to left
708  else
709  _Where->_Parent->_Right = _Node; // link down to right
710 
711  _Node->_Parent = _Where->_Parent; // link successor up
712 
713  signed char _Color = _Node->_Color;
714 
715  _Node->_Color = _Where->_Color;
716  _Where->_Color = _Color; // recolor it
717  }
718 
719  if (_Where->_Color == _Black)
720  { // erasing black link, must recolor/rebalance tree
721  for (; _Fixnode != root_node() && _Fixnode->_Color == _Black;
722  _Fixnodeparent = _Fixnode->_Parent)
723  if (_Fixnode == _Fixnodeparent->_Left)
724  { // fixup left subtree
725  _Node = _Fixnodeparent->_Right;
726  if (_Node->_Color == _Red)
727  { // rotate red up from right subtree
728  _Node->_Color = _Black;
729  _Fixnodeparent->_Color = _Red;
730  _Lrotate(_Fixnodeparent);
731  _Node = _Fixnodeparent->_Right;
732  }
733 
734  if (_Node->is_head())
735  _Fixnode = _Fixnodeparent; // shouldn't happen
736  else if (_Node->_Left->_Color == _Black
737  && _Node->_Right->_Color == _Black)
738  { // redden right subtree with black children
739  _Node->_Color = _Red;
740  _Fixnode = _Fixnodeparent;
741  }
742  else
743  { // must rearrange right subtree
744  if (_Node->_Right->_Color == _Black)
745  { // rotate red up from left sub-subtree
746  _Node->_Left->_Color = _Black;
747  _Node->_Color = _Red;
748  _Rrotate(_Node);
749  _Node = _Fixnodeparent->_Right;
750  }
751 
752  _Node->_Color = _Fixnodeparent->_Color;
753  _Fixnodeparent->_Color = _Black;
754  _Node->_Right->_Color = _Black;
755  _Lrotate(_Fixnodeparent);
756  break; // tree now recolored/rebalanced
757  }
758  }
759  else
760  { // fixup right subtree
761  _Node = _Fixnodeparent->_Left;
762  if (_Node->_Color == _Red)
763  { // rotate red up from left subtree
764  _Node->_Color = _Black;
765  _Fixnodeparent->_Color = _Red;
766  _Rrotate(_Fixnodeparent);
767  _Node = _Fixnodeparent->_Left;
768  }
769  if (_Node->is_head())
770  _Fixnode = _Fixnodeparent; // shouldn't happen
771  else if (_Node->_Right->_Color == _Black
772  && _Node->_Left->_Color == _Black)
773  { // redden left subtree with black children
774  _Node->_Color = _Red;
775  _Fixnode = _Fixnodeparent;
776  }
777  else
778  { // must rearrange left subtree
779  if (_Node->_Left->_Color == _Black)
780  { // rotate red up from right sub-subtree
781  _Node->_Right->_Color = _Black;
782  _Node->_Color = _Red;
783  _Lrotate(_Node);
784  _Node = _Fixnodeparent->_Left;
785  }
786 
787  _Node->_Color = _Fixnodeparent->_Color;
788  _Fixnodeparent->_Color = _Black;
789  _Node->_Left->_Color = _Black;
790  _Rrotate(_Fixnodeparent);
791  break; // tree now recolored/rebalanced
792  }
793  }
794 
795  _Fixnode->_Color = _Black; // ensure stopping node is black
796  }
797 
798  _Mybase_t::unmake_value(_Where->_Myval);
799  _Where->_Head = nullptr; // orphan corresponding iterators
800  --_Mysize;
801  ++_Mygen;
802  return (_Next);
803  }
unsigned long _Mygen
Definition: xtree:1114
_Mytype_t _Right
Definition: xtree:129
signed char _Color
Definition: xtree:131
tree_node< _Key_t, _Value_t > node_type
Definition: xtree:192
node_type back_node()
Definition: xtree:302
_Node _Left
Definition: xtree:905
node_type head_node()
Definition: xtree:312
node_type front_node()
Definition: xtree:297
void _Lrotate(node_type^_Where)
Definition: xtree:1071
_Node _Color
Definition: xtree:909
_Mytype_t _Parent
Definition: xtree:128
_Mytype_t _Left
Definition: xtree:127
node_type root_node()
Definition: xtree:307
_Node _Parent
Definition: xtree:906
void _Rrotate(node_type^_Where)
Definition: xtree:1091
static const int _Red
Definition: xtree:235
if(__pUnknown!=*__ppTargetUnknown)
Definition: vccorlib.h:399
static const int _Black
Definition: xtree:234
size_type _Mysize
Definition: xtree:1113
template<typename _Traits_t>
iterator cliext::impl::tree< _Traits_t >::find ( key_type  _Keyval)
inline
824  { // find an element that matches _Keyval, return iterator
825  node_type^ _Where = lower_bound_node(_Keyval);
826 
827  return (make_iterator(_Where == head_node()
828  || this->comp(_Keyval, _Key(_Where))
829  ? head_node() : _Where));
830  }
node_type lower_bound_node(key_type _Keyval)
Definition: xtree:848
tree_node< _Key_t, _Value_t > node_type
Definition: xtree:192
iterator make_iterator(node_type^_Node)
Definition: xtree:348
node_type head_node()
Definition: xtree:312
key_type _Key(node_type^_Where)
Definition: xtree:1066
template<typename _Traits_t>
node_type cliext::impl::tree< _Traits_t >::front_node ( )
inline
298  { // return leftmost node in tree
299  return (head_node()->_Left);
300  }
_Node _Left
Definition: xtree:905
node_type head_node()
Definition: xtree:312
template<typename _Traits_t>
unsigned long cliext::impl::tree< _Traits_t >::get_generation ( )
inline
284  { // get underlying container generation
285  return (_Mygen);
286  }
unsigned long _Mygen
Definition: xtree:1114
template<typename _Traits_t>
node_type cliext::impl::tree< _Traits_t >::get_node ( iterator  _Where)
inline
289  { // get node from valid iterator
290  node_type^ _Node = (node_type^)_Where.get_node();
291 
292  if (_Node == nullptr || _Node->container() != (System::Object^)this)
293  throw gcnew System::InvalidOperationException();
294  return (_Node);
295  }
tree_node< _Key_t, _Value_t > node_type
Definition: xtree:192
template<typename _Traits_t>
node_type cliext::impl::tree< _Traits_t >::head_node ( )
inline
313  { // get head node
314  return (_Myhead);
315  }
node_type _Myhead
Definition: xtree:1112
template<typename _Traits_t>
pair_iter_bool cliext::impl::tree< _Traits_t >::insert ( value_type  _Val)
inline
401  { // try to insert node with value _Val, return iterator, bool
402  _Pairnb _Ans = insert_node(_Val);
403 
404  return (pair_iter_bool(iterator(_Ans.first),
405  _Ans.second));
406  }
_Pairnb insert_node(value_type _Val)
Definition: xtree:495
_STLCLR GenericPair< iterator, bool > pair_iter_bool
Definition: xtree:221
_STLCLR GenericPair< node_type^, bool > _Pairnb
Definition: xtree:223
BidirectionalIterator< _Mytype_t > iterator
Definition: xtree:195
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<typename _Traits_t>
iterator cliext::impl::tree< _Traits_t >::insert ( iterator  _Where,
value_type  _Val 
)
inline
409  { // try to insert node with value _Val at _Where, return iterator
410  return (make_iterator(insert_node(get_node(_Where), _Val)));
411  }
_Pairnb insert_node(value_type _Val)
Definition: xtree:495
iterator make_iterator(node_type^_Node)
Definition: xtree:348
node_type get_node(iterator _Where)
Definition: xtree:288
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<typename _Traits_t>
template<typename _Iter_t >
void cliext::impl::tree< _Traits_t >::insert ( _Iter_t  _First,
_Iter_t  _Last 
)
inline
415  { // insert [_First, _Last) one at a time
416 #pragma warning(push)
417 #pragma warning(disable: 4127)
418  if (_Iter_container(_First) != this)
419  for (; _First != _Last; ++_First)
420  insert_node(*_First);
421  else if (_Multi)
422  { // worth assigning to self
423  node_type^ _Node = nullptr;
424 
425  for (; _First != _Last; ++_First)
426  _Node = _Buynode(nullptr, nullptr, _Node,
427  (value_type)*_First, 0);
428  for (; _Node != nullptr; _Node = _Node->_Right)
429  insert_node(_Node->_Myval); // insert accumulated sequence
430  }
431 #pragma warning(pop)
432  }
_Pairnb insert_node(value_type _Val)
Definition: xtree:495
tree_node< _Key_t, _Value_t > node_type
Definition: xtree:192
node_type _Buynode(node_type^_Larg, node_type^_Parg, node_type^_Rarg, value_type _Val, signed char _Carg)
Definition: xtree:914
_Traits_t::value_type value_type
Definition: xtree:204
System::Object _Iter_container(_Iter_t%_Next)
Definition: iterator:4248
_FwdIt _Last
Definition: algorithm:1936
template<typename _Traits_t>
void cliext::impl::tree< _Traits_t >::insert ( _STLCLR Generic::IInputIterator< _Value_t >^  _First,
_STLCLR Generic::IInputIterator< _Value_t >^  _Last 
)
inline
437  { // insert [_First, _Last) one at a time
438 #pragma warning(push)
439 #pragma warning(disable: 4127)
440  if (_Iter_container(_First) != this)
441  for (; !_First->equal_to(_Last); _First->next())
442  insert_node((value_type%)_First->get_cref());
443  else if (_Multi)
444  { // worth assigning to self
445  node_type^ _Node = nullptr;
446 
447  for (; !_First->equal_to(_Last); _First->next())
448  _Node = _Buynode(nullptr, nullptr, _Node,
449  (value_type)_First->get_cref(), 0);
450  for (; _Node != nullptr; _Node = _Node->_Right)
451  insert_node(_Node->_Myval); // insert accumulated sequence
452  }
453 #pragma warning(pop)
454  }
_Pairnb insert_node(value_type _Val)
Definition: xtree:495
tree_node< _Key_t, _Value_t > node_type
Definition: xtree:192
node_type _Buynode(node_type^_Larg, node_type^_Parg, node_type^_Rarg, value_type _Val, signed char _Carg)
Definition: xtree:914
_Traits_t::value_type value_type
Definition: xtree:204
System::Object _Iter_container(_Iter_t%_Next)
Definition: iterator:4248
_FwdIt _Last
Definition: algorithm:1936
template<typename _Traits_t>
void cliext::impl::tree< _Traits_t >::insert ( _Myenum_it _Right)
inline
457  { // insert enumerable
458  node_type^ _Node = nullptr;
459 
460  for each (value_type _Val in _Right)
461  _Node = _Buynode(nullptr, nullptr, _Node,
462  _Val, 0);
463  for (; _Node != nullptr; _Node = _Node->_Right)
464  insert_node(_Node->_Myval); // insert accumulated sequence
465  }
_Pairnb insert_node(value_type _Val)
Definition: xtree:495
tree_node< _Key_t, _Value_t > node_type
Definition: xtree:192
node_type _Buynode(node_type^_Larg, node_type^_Parg, node_type^_Rarg, value_type _Val, signed char _Carg)
Definition: xtree:914
_Traits_t::value_type value_type
Definition: xtree:204
_Node _Right
Definition: xtree:907
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<typename _Traits_t>
void cliext::impl::tree< _Traits_t >::insert_iter ( _STLCLR Generic::IInputIterator< _Value_t >^  _First,
_STLCLR Generic::IInputIterator< _Value_t >^  _Last 
)
inline
476  { // insert [_First, _Last) one at a time
477 #pragma warning(push)
478 #pragma warning(disable: 4127)
479  if (_First->container() != this)
480  for (; !_First->equal_to(_Last); _First->next())
481  insert_node((value_type%)_First->get_cref());
482  else if (_Multi)
483  { // worth assigning to self
484  node_type^ _Node = nullptr;
485 
486  for (; !_First->equal_to(_Last); _First->next())
487  _Node = _Buynode(nullptr, nullptr, _Node,
488  (value_type%)_First->get_cref(), 0);
489  for (; _Node != nullptr; _Node = _Node->_Right)
490  insert_node(_Node->_Myval); // insert accumulated sequence
491  }
492 #pragma warning(pop)
493  }
_Pairnb insert_node(value_type _Val)
Definition: xtree:495
tree_node< _Key_t, _Value_t > node_type
Definition: xtree:192
node_type _Buynode(node_type^_Larg, node_type^_Parg, node_type^_Rarg, value_type _Val, signed char _Carg)
Definition: xtree:914
_Traits_t::value_type value_type
Definition: xtree:204
_FwdIt _Last
Definition: algorithm:1936
template<typename _Traits_t>
_Pairnb cliext::impl::tree< _Traits_t >::insert_node ( value_type  _Val)
inline
496  { // try to insert node with value _Val, return node pointer, bool
497 #pragma warning(push)
498 #pragma warning(disable: 4127)
499  node_type^ _Node = root_node();
500  node_type^ _Where = head_node();
501  bool _Addleft = true; // add to left of head if tree empty
502 
503  while (!_Node->is_head())
504  { // look for leaf to insert before (_Addleft) or after
505  _Where = _Node;
506  _Addleft = this->comp(this->get_key(_Val), _Key(_Node));
507  _Node = _Addleft ? _Node->_Left : _Node->_Right;
508  }
509 
510  if (this->_Multi)
511  return (_Pairnb(_Insert_node(_Addleft, _Where, _Val),
512  true));
513  else
514  { // insert only if unique
515  if (!_Addleft)
516  _Node = _Where; // need to test if insert after is okay
517  else if (_Where == front_node())
518  return (_Pairnb(_Insert_node(true, _Where, _Val),
519  true));
520  else // need to test if before is okay
521  _Node = _Where->prev_node();
522 
523  if (this->comp(_Key(_Node), this->get_key(_Val)))
524  return (_Pairnb(_Insert_node(_Addleft, _Where, _Val),
525  true));
526  else
527  return (_Pairnb(_Node, false));
528  }
529 #pragma warning(pop)
530  }
tree_node< _Key_t, _Value_t > node_type
Definition: xtree:192
_STLCLR GenericPair< node_type^, bool > _Pairnb
Definition: xtree:223
node_type head_node()
Definition: xtree:312
node_type front_node()
Definition: xtree:297
node_type _Insert_node(bool _Addleft, node_type^_Where, value_type _Val)
Definition: xtree:984
node_type root_node()
Definition: xtree:307
_FwdIt const _Ty _Val
Definition: algorithm:1938
key_type _Key(node_type^_Where)
Definition: xtree:1066
template<typename _Traits_t>
node_type cliext::impl::tree< _Traits_t >::insert_node ( node_type _Where_node,
value_type  _Val 
)
inline
533  { // try to insert node with value _Val at _Where, return node
534 #pragma warning(push)
535 #pragma warning(disable: 4127)
536  node_type^ _Where = (node_type^)_Where_node;
537  node_type^ _Next;
538 
539  if (_Where->container() != this)
540  throw gcnew System::ArgumentException();
541 
542  if (empty())
543  return (_Insert_node(true, head_node(), _Val));
544  else if (this->_Multi)
545  { // insert even if duplicate
546  if (_Where == front_node())
547  { // insert at beginning if before first element
548  if (!this->comp(_Key(_Where), this->get_key(_Val)))
549  return (_Insert_node(true, _Where, _Val));
550  }
551  else if (_Where == head_node())
552  { // insert at end if after last element
553  if (!this->comp(this->get_key(_Val), _Key(back_node())))
554  return (_Insert_node(false, back_node(), _Val));
555  }
556  else if (!this->comp(_Key(_Where), this->get_key(_Val))
557  && !this->comp(this->get_key(_Val),
558  _Key(_Next = _Where->prev_node())))
559  { // insert before _Where
560  if (_Next->_Right->is_head())
561  return (_Insert_node(false, _Next, _Val));
562  else
563  return (_Insert_node(true, _Where, _Val));
564  }
565  else if (!this->comp(this->get_key(_Val), _Key(_Where))
566  && ((_Next = _Where->next_node())
567  == head_node()
568  || !this->comp(_Key(_Next), this->get_key(_Val))))
569  { // insert after _Where
570  if (_Where->_Right->is_head())
571  return (_Insert_node(false, _Where, _Val));
572  else
573  return (_Insert_node(true, _Next, _Val));
574  }
575  }
576  else
577  { // insert only if unique
578  if (_Where == front_node())
579  { // insert at beginning if before first element
580  if (this->comp(this->get_key(_Val), _Key(_Where)))
581  return (_Insert_node(true, _Where, _Val));
582  }
583  else if (_Where == head_node())
584  { // insert at end if after last element
585  if (this->comp(_Key(back_node()), this->get_key(_Val)))
586  return (_Insert_node(false, back_node(), _Val));
587  }
588  else if (this->comp(this->get_key(_Val), _Key(_Where))
589  && this->comp(_Key(
590  _Next = _Where->prev_node()),
591  this->get_key(_Val)))
592  { // insert before _Where
593  if (_Next->_Right->is_head())
594  return (_Insert_node(false, _Next, _Val));
595  else
596  return (_Insert_node(true, _Where, _Val));
597  }
598  else if (this->comp(_Key(_Where), this->get_key(_Val))
599  && ((_Next = _Where->next_node())
600  == head_node()
601  || this->comp(this->get_key(_Val), _Key(_Next))))
602  { // insert after _Where
603  if (_Where->_Right->is_head())
604  return (_Insert_node(false, _Where, _Val));
605  else
606  return (_Insert_node(true, _Next, _Val));
607  }
608  }
609 
610  return (insert_node(_Val).first); // try usual insert
611 #pragma warning(pop)
612  }
_Pairnb insert_node(value_type _Val)
Definition: xtree:495
tree_node< _Key_t, _Value_t > node_type
Definition: xtree:192
node_type back_node()
Definition: xtree:302
node_type head_node()
Definition: xtree:312
node_type front_node()
Definition: xtree:297
bool empty()
Definition: xtree:384
node_type _Insert_node(bool _Addleft, node_type^_Where, value_type _Val)
Definition: xtree:984
_FwdIt const _Ty _Val
Definition: algorithm:1938
key_type _Key(node_type^_Where)
Definition: xtree:1066
template<typename _Traits_t>
key_compare cliext::impl::tree< _Traits_t >::key_comp ( )
inlinenew
338  { // return object for comparing keys
339  return (_Mybase_t::key_comp());
340  }
template<typename _Traits_t>
iterator cliext::impl::tree< _Traits_t >::lower_bound ( key_type  _Keyval)
inline
844  { // find leftmost node not less than _Keyval
845  return (make_iterator(lower_bound_node(_Keyval)));
846  }
node_type lower_bound_node(key_type _Keyval)
Definition: xtree:848
iterator make_iterator(node_type^_Node)
Definition: xtree:348
template<typename _Traits_t>
node_type cliext::impl::tree< _Traits_t >::lower_bound_node ( key_type  _Keyval)
inline
849  { // find leftmost node not less than _Keyval
850  node_type^ _Node = root_node();
851  node_type^ _Where = head_node(); // end() if search fails
852 
853  while (!_Node->is_head())
854  if (this->comp(_Key(_Node), _Keyval))
855  _Node = _Node->_Right; // descend right subtree
856  else
857  { // _Node not less than _Keyval, remember it
858  _Where = _Node;
859  _Node = _Node->_Left; // descend left subtree
860  }
861 
862  return (_Where); // return best remembered candidate
863  }
tree_node< _Key_t, _Value_t > node_type
Definition: xtree:192
node_type head_node()
Definition: xtree:312
node_type root_node()
Definition: xtree:307
key_type _Key(node_type^_Where)
Definition: xtree:1066
template<typename _Traits_t>
iterator cliext::impl::tree< _Traits_t >::make_iterator ( node_type _Node)
inline
349  { // return iterator for node
350  return (iterator(_Node));
351  }
BidirectionalIterator< _Mytype_t > iterator
Definition: xtree:195
template<typename _Traits_t>
cliext::impl::tree< _Traits_t >::operator _Mycont_it^ ( )
inline
261  { // convert to interface
262  return (this);
263  }
template<typename _Traits_t>
tree cliext::impl::tree< _Traits_t >::operator= ( tree< _Traits_t >%  _Right)
inline
251  { // assign
252  if ((Object^)this != %_Right)
253  { // worth doing, do it
254  clear();
255  _Copy(%_Right);
256  }
257  return (*this);
258  }
void clear()
Definition: xtree:805
void _Copy(tree^_Right)
Definition: xtree:941
_Node _Right
Definition: xtree:907
template<typename _Traits_t>
reverse_iterator cliext::impl::tree< _Traits_t >::rbegin ( )
inline
364  { // return reverse iterator for beginning of mutable sequence
365  return (reverse_iterator(end()));
366  }
ReverseBidirectionalIterator< _Mytype_t > reverse_iterator
Definition: xtree:199
iterator end()
Definition: xtree:358
template<typename _Traits_t>
reverse_iterator cliext::impl::tree< _Traits_t >::rend ( )
inline
369  { // return reverse iterator for end of mutable sequence
370  return (reverse_iterator(begin()));
371  }
ReverseBidirectionalIterator< _Mytype_t > reverse_iterator
Definition: xtree:199
iterator begin()
Definition: xtree:353
template<typename _Traits_t>
cliext::impl::tree< _Traits_t >::return ( _Node  )
template<typename _Traits_t>
node_type cliext::impl::tree< _Traits_t >::root_node ( )
inline
308  { // return root of tree
309  return (head_node()->_Parent);
310  }
node_type head_node()
Definition: xtree:312
_Node _Parent
Definition: xtree:906
template<typename _Traits_t>
size_type cliext::impl::tree< _Traits_t >::size ( )
inline
380  { // return length of sequence
381  return (_Mysize);
382  }
size_type _Mysize
Definition: xtree:1113
template<typename _Traits_t>
void cliext::impl::tree< _Traits_t >::swap ( _Mytype_t _Right)
inline
812  { // exchange contents with _Right
813  if ((Object^)this != %_Right)
814  { // worth doing, swap
815  tree^ _Temp = gcnew tree(_Right);
816 
817  _Right._Copy(this);
818  _Copy(_Temp);
819  }
820  }
void _Copy(tree^_Right)
Definition: xtree:941
tree()
Definition: xtree:238
_Node _Right
Definition: xtree:907
template<typename _Traits_t>
_Myarray_t cliext::impl::tree< _Traits_t >::to_array ( )
inline
325  { // convert to array
326  _Myarray_t^ _Ans = gcnew _Myarray_t(size());
327  node_type^ _Node = head_node();
328 
329  for (int _Idx = size(); 0 <= --_Idx; )
330  { // copy back to front
331  _Node = _Node->prev_node();
332  _Ans[_Idx] = _Node->_Myval;
333  }
334  return (_Ans);
335  }
size_type size()
Definition: xtree:379
tree_node< _Key_t, _Value_t > node_type
Definition: xtree:192
node_type head_node()
Definition: xtree:312
cli::array< _Value_t > _Myarray_t
Definition: xtree:190
template<typename _Traits_t>
iterator cliext::impl::tree< _Traits_t >::upper_bound ( key_type  _Keyval)
inline
866  { // find leftmost node greater than _Keyval
867  return (make_iterator(upper_bound_node(_Keyval)));
868  }
iterator make_iterator(node_type^_Node)
Definition: xtree:348
node_type upper_bound_node(key_type _Keyval)
Definition: xtree:870
template<typename _Traits_t>
node_type cliext::impl::tree< _Traits_t >::upper_bound_node ( key_type  _Keyval)
inline
871  { // find leftmost node greater than _Keyval
872  node_type^ _Node = root_node();
873  node_type^ _Where = head_node(); // end() if search fails
874 
875  while (!_Node->is_head())
876  if (this->comp(_Keyval, _Key(_Node)))
877  { // _Node greater than _Keyval, remember it
878  _Where = _Node;
879  _Node = _Node->_Left; // descend left subtree
880  }
881  else
882  _Node = _Node->_Right; // descend right subtree
883 
884  return (_Where); // return best remembered candidate
885  }
tree_node< _Key_t, _Value_t > node_type
Definition: xtree:192
node_type head_node()
Definition: xtree:312
node_type root_node()
Definition: xtree:307
key_type _Key(node_type^_Where)
Definition: xtree:1066
template<typename _Traits_t>
value_compare cliext::impl::tree< _Traits_t >::value_comp ( )
inlinenew
343  { // return object for comparing keys
344  return (_Mybase_t::value_comp());
345  }

Member Data Documentation

template<typename _Traits_t>
_STLCLR_FIELD_ACCESS cliext::impl::tree< _Traits_t >::__pad0__
template<typename _Traits_t>
const int cliext::impl::tree< _Traits_t >::_Black = 0
static
template<typename _Traits_t>
_Node cliext::impl::tree< _Traits_t >::_Color = _Black
template<typename _Traits_t>
_Node cliext::impl::tree< _Traits_t >::_Head = _Node
template<typename _Traits_t>
_Node cliext::impl::tree< _Traits_t >::_Left = _Node
template<typename _Traits_t>
const int cliext::impl::tree< _Traits_t >::_Maxsize = MAX_CONTAINER_SIZE
static
template<typename _Traits_t>
_Node cliext::impl::tree< _Traits_t >::_Mycont = this
template<typename _Traits_t>
unsigned long cliext::impl::tree< _Traits_t >::_Mygen
template<typename _Traits_t>
node_type cliext::impl::tree< _Traits_t >::_Myhead
template<typename _Traits_t>
size_type cliext::impl::tree< _Traits_t >::_Mysize
template<typename _Traits_t>
_Node cliext::impl::tree< _Traits_t >::_Parent = _Node
template<typename _Traits_t>
const int cliext::impl::tree< _Traits_t >::_Red = 1
static
template<typename _Traits_t>
_Node cliext::impl::tree< _Traits_t >::_Right = _Node
template<typename _Traits_t>
property size_type cliext::impl::tree< _Traits_t >::Count
private
Initial value:
{
virtual size_type get() sealed
{
return (size());
}
}
template<typename _Traits_t>
property bool cliext::impl::tree< _Traits_t >::IsSynchronized
private
Initial value:
{
virtual bool get() sealed
{
return (false);
}
}
template<typename _Traits_t>
property System::Object cliext::impl::tree< _Traits_t >::SyncRoot
private
Initial value:
{
virtual System::Object^ get() sealed
{
return (this);
}
}

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