So it's been a while since I've done any c++ coding and I was just wondering which variables in a basic linked list should be deleted in the destructor and unfortunately I can't consult my c++ handbook at the moment regarding the matter. The linked list class looks as follows:
List(string _s, int _i)
next = nullptr;
sName = _s;
for (int i = 0; i < _i; i++)
//since sName is assigned during runtime do I delete?
//same for cvStuff?
Basically you should just
and that's all you should do:
vector objects have their own destructors, and since this object is being destructed, theirs will be called.
Deleting a null pointer is not a problem, so you don't even have to check for that.
next is not a null pointer, it will keep on calling the destructors of the next nodes, on and on, as needed.
Just delete it and that's all, then.