Website Summary Files Commits Branches @commit @diff @stats
path: root / src / List / List.cpp
diff options
context:
space:
mode:
Commit9f5eb77f6a8cba01158c37dc17e7e53574d87127 (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-04-28 19:10:39 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-04-28 19:10:39 +0300
Files013aaa84243f4d26032df04191b250a1f9b5dc89 /src/List/List.cpp
FMI-OOP-P1_TicketSystem-9f5eb77f6a8cba01158c37dc17e7e53574d87127.tar
FMI-OOP-P1_TicketSystem-9f5eb77f6a8cba01158c37dc17e7e53574d87127.tar.gz
FMI-OOP-P1_TicketSystem-9f5eb77f6a8cba01158c37dc17e7e53574d87127.zip
Parentc1c753cbbd384a46c6a81a62e667347299757267 (diff)
Autocommit at 28.04.2022 @ 19:10
1 files changed, 43 insertions, 1 deletions
-rw-r--r--src/List/List.cpp44
diff --git a/src/List/List.cpp b/src/List/List.cpp
index a1892dd..1312e61 100644
--- a/src/List/List.cpp
+++ b/src/List/List.cpp
@@ -54,5 +54,47 @@ T& List<T>::operator[](unsigned index) {
template <class T>
List<T>::List() {
-
+ length = 8;
+ count = 0;
+ elements = new T[length];
+}
+
+template <class T>
+List<T>& List<T>::operator=(const List& other) {
+ if (this != &other) {
+ free();
+ copyFrom(other);
+ }
+ return *this;
+}
+
+template <class T>
+List<T>::List(const List& other) {
+ copyFrom(other);
+}
+
+template <class T>
+List<T>::~List() {
+ free();
+}
+
+// Move semantics
+
+template <class T>
+List<T>::List(List&& other) {
+ length = other.length;
+ count = other.count;
+ elements = other.elements;
+ other.elements = nullptr;
+}
+
+template <class T>
+List<T>& List<T>::operator=(List&& other) {
+ if (this != other) {
+ length = other.length;
+ count = other.count;
+ elements = other.elements;
+ other.elements = nullptr;
+ }
+ return *this;
}