From b36e4736f5634f6536eba66a08088e0e58e25f4d Mon Sep 17 00:00:00 2001 From: Alvin Philips Date: Tue, 2 Nov 2021 07:36:17 +0530 Subject: [PATCH] Added move constructor and assignment operator --- operations_on_datastructures/circular_linked_list.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/operations_on_datastructures/circular_linked_list.cpp b/operations_on_datastructures/circular_linked_list.cpp index 2ec624ace..2ddb626db 100644 --- a/operations_on_datastructures/circular_linked_list.cpp +++ b/operations_on_datastructures/circular_linked_list.cpp @@ -74,7 +74,15 @@ class CircularLinkedList { root = copy.root; end = copy.end; } - void operator=(const CircularLinkedList& other) { + CircularLinkedList(CircularLinkedList&& source) { + root = source.root; + end = source.end; + } + CircularLinkedList& operator=(const CircularLinkedList& other) { + root = other.root; + end = other.end; + } + CircularLinkedList& operator=(CircularLinkedList&& other) { root = other.root; end = other.end; }