(list)+destructor function in struct

Nice feature of C++, destructors make it kinda nice to do memory
management. Though they don't fully reduce the pain lol
This commit is contained in:
2021-11-20 22:57:27 +00:00
parent cae91a793c
commit e30444cdde

View File

@@ -12,6 +12,13 @@ struct List
{
T value;
struct List<T> *next;
~List()
{
if (next == NULL)
return;
delete next;
}
};
template <typename T>