From 9cdecb790b25e92317f328d89fd772cda02f3ad0 Mon Sep 17 00:00:00 2001 From: Pagwin Date: Sun, 24 Nov 2024 02:08:39 -0500 Subject: [PATCH] some progress was made --- Map.hpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Map.hpp b/Map.hpp index e5a4c06..42a368c 100644 --- a/Map.hpp +++ b/Map.hpp @@ -385,8 +385,22 @@ private: 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)); + if (root.value().left) { + root.value().left->parent = &root.value(); + } + if (root.value().right) { + root.value().right->parent = &root.value(); + } } template std::pair locate(const Key_T &key) { @@ -557,6 +571,7 @@ private: } return true; } else if (erasing->right) { + //!! *erasing = std::move(*erasing->right); if (erasing->prev != nullptr) { erasing->prev->next = erasing;