diff --git a/include/RedBlackTree.h b/include/RedBlackTree.h index 739ea49..216dac0 100644 --- a/include/RedBlackTree.h +++ b/include/RedBlackTree.h @@ -118,6 +118,24 @@ namespace ling { public: explicit RedBlackTree() = default; + RedBlackTree(const RedBlackTree &other) = delete; + + RedBlackTree(RedBlackTree &&other) noexcept { + this->rootNode = other.rootNode; + other.rootNode = nullptr; + } + + RedBlackTree &operator=(RedBlackTree &&other) noexcept { + if (this == &other) { + return *this; + } + this->rootNode = other.rootNode; + other.rootNode = nullptr; + return *this; + } + + RedBlackTree &operator=(const RedBlackTree &other) = delete; + virtual ~RedBlackTree() { destroy(); }