1

fix list destructors

This commit is contained in:
2022-07-19 14:56:59 +02:00
parent c319c0b604
commit 2f47dc8f94
3 changed files with 2 additions and 4 deletions

View File

@ -120,7 +120,7 @@ private:
} }
public: public:
~ArrayList() override { ~ArrayList() {
delete[] buf; // Deleting nullptr has no effect delete[] buf; // Deleting nullptr has no effect
} }

View File

@ -65,7 +65,7 @@ private:
} }
public: public:
~LinkedList() override { ~LinkedList() {
typename Iterator::Type* current = head; typename Iterator::Type* current = head;
typename Iterator::Type* next; typename Iterator::Type* next;

View File

@ -9,8 +9,6 @@
template<typename T, typename I = Iterator<T>> template<typename T, typename I = Iterator<T>>
class List { class List {
public: public:
virtual ~List() = 0;
using Type = T; // We make the template argument accessible from the subclasses using Type = T; // We make the template argument accessible from the subclasses
using Iterator = I; // Needed for range based for loop using Iterator = I; // Needed for range based for loop