Changeset cacb5d0 in mainline for uspace/lib/cpp/include/internal/rbtree_node.hpp
- Timestamp:
- 2018-07-05T21:41:22Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 647b756
- Parents:
- af0fbaac
- git-author:
- Dzejrou <dzejrou@…> (2018-04-30 19:48:15)
- git-committer:
- Dzejrou <dzejrou@…> (2018-07-05 21:41:22)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/cpp/include/internal/rbtree_node.hpp
raf0fbaac rcacb5d0 124 124 } 125 125 126 const rbtree_node* find_smallest() const 127 { 128 auto res = this; 129 while (res->left) 130 res = res->left; 131 132 return res; 133 } 134 126 135 rbtree_node* find_largest() 127 136 { … … 133 142 } 134 143 135 rbtree_node* successor() 144 const rbtree_node* find_largest() const 145 { 146 auto res = this; 147 while (res->right) 148 res = res->right; 149 150 return res; 151 } 152 153 rbtree_node* successor() const 136 154 { 137 155 if (right) … … 167 185 void swap(rbtree_node* other) 168 186 { 169 /** 170 * Parent can be null so we check both ways. 171 */ 172 if (is_left_child()) 173 parent->left = other; 174 else if (is_right_child()) 175 parent->right = other; 176 177 if (other->is_left_child()) 178 other->parent->left = this; 179 else if (other->is_right_child()) 180 other->parent->right = this; 181 182 if (left) 183 left->parent = other; 184 if (right) 185 right->parent = other; 186 if (other->left) 187 other->left->parent = this; 188 if (other->right) 189 other->right->parent = this; 190 191 std::swap(parent, other->parent); 192 std::swap(left, other->left); 193 std::swap(right, other->right); 187 std::swap(value, other->value); 194 188 } 195 189
Note:
See TracChangeset
for help on using the changeset viewer.