From 578515d65f3d0281f34da00c7243e55bbe63cc6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=BB=E9=AD=82=E5=9C=A3=E4=BD=BF?= Date: Sat, 7 Sep 2024 14:23:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BE=9B=E7=BA=A2=E9=BB=91=E6=A0=91?= =?UTF-8?q?=E7=9A=84=E7=A7=BB=E5=8A=A8=E6=9E=84=E9=80=A0=E5=92=8C=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E8=B5=8B=E5=80=BC=E5=87=BD=E6=95=B0=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=8B=B7=E8=B4=9D=E6=9E=84=E9=80=A0=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E6=8B=B7=E8=B4=9D=E8=B5=8B=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/RedBlackTree.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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(); }