aboutsummaryrefslogtreecommitdiff
path: root/list.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'list.cpp')
-rw-r--r--list.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/list.cpp b/list.cpp
index da9ad4f..873dfe9 100644
--- a/list.cpp
+++ b/list.cpp
@@ -12,6 +12,13 @@ struct List
{
T value;
struct List<T> *next;
+
+ ~List()
+ {
+ if (next == NULL)
+ return;
+ delete next;
+ }
};
template <typename T>