Website Summary Files Commits Branches @commit @diff @stats
path: root / src
diff options
context:
space:
mode:
2 files changed, 3 insertions, 1 deletions
-rw-r--r--src/List/List.cpp3
-rw-r--r--src/List/List.h1
diff --git a/src/List/List.cpp b/src/List/List.cpp
index 1312e61..66d66df 100644
--- a/src/List/List.cpp
+++ b/src/List/List.cpp
@@ -90,7 +90,8 @@ List<T>::List(List&& other) {
template <class T>
List<T>& List<T>::operator=(List&& other) {
- if (this != other) {
+ if (this != &other) {
+ free();
length = other.length;
count = other.count;
elements = other.elements;
diff --git a/src/List/List.h b/src/List/List.h
index c6f074d..0f256e5 100644
--- a/src/List/List.h
+++ b/src/List/List.h
@@ -10,6 +10,7 @@ class List {
void resize();
void free();
void copyFrom(const List& other);
+
public:
void add(const T& element);
bool removeAt(unsigned index);