some progress was made
This commit is contained in:
parent
c3eaa8783b
commit
9cdecb790b
1 changed files with 16 additions and 1 deletions
17
Map.hpp
17
Map.hpp
|
@ -385,8 +385,22 @@ private:
|
||||||
|
|
||||||
root.value() = std::move(*new_root);
|
root.value() = std::move(*new_root);
|
||||||
|
|
||||||
old_root->set_child(!dir, root.value().uchild(dir));
|
old_root->set_child(!dir, old_root->uchild(dir));
|
||||||
|
|
||||||
|
if (old_root->left) {
|
||||||
|
old_root->left->parent = old_root.get();
|
||||||
|
}
|
||||||
|
if (old_root->right) {
|
||||||
|
old_root->right->parent = old_root.get();
|
||||||
|
}
|
||||||
|
|
||||||
root.value().set_child(dir, std::move(old_root));
|
root.value().set_child(dir, std::move(old_root));
|
||||||
|
if (root.value().left) {
|
||||||
|
root.value().left->parent = &root.value();
|
||||||
|
}
|
||||||
|
if (root.value().right) {
|
||||||
|
root.value().right->parent = &root.value();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
template <bool trace = false>
|
template <bool trace = false>
|
||||||
std::pair<Node *, Direction> locate(const Key_T &key) {
|
std::pair<Node *, Direction> locate(const Key_T &key) {
|
||||||
|
@ -557,6 +571,7 @@ private:
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else if (erasing->right) {
|
} else if (erasing->right) {
|
||||||
|
//!!
|
||||||
*erasing = std::move(*erasing->right);
|
*erasing = std::move(*erasing->right);
|
||||||
if (erasing->prev != nullptr) {
|
if (erasing->prev != nullptr) {
|
||||||
erasing->prev->next = erasing;
|
erasing->prev->next = erasing;
|
||||||
|
|
Loading…
Reference in a new issue