fix list destructors
This commit is contained in:
@ -120,7 +120,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~ArrayList() override {
|
~ArrayList() {
|
||||||
delete[] buf; // Deleting nullptr has no effect
|
delete[] buf; // Deleting nullptr has no effect
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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;
|
||||||
|
|
||||||
|
|||||||
@ -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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user