Code: Select all
LinkedList::~LinkedList()
{
while (first != 0)
{
NodePointer ptr = first;
first = ptr->next;
delete ptr;
}
if (first == 0) cout << "List destroyed\n";
else cout << "List not destroyed\n";
}
I always get a "Debug Assertion Failed!"
Expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
the code that is being executed
Code: Select all
{
LinkedList anotherList;
for (int i = 0; i < 5; i++)
anotherList.insert(i, 20 * i);
cout << "\nHere's another list:\n" << anotherList << endl;
cout << "Now destroying this list\n";
}
cout << "*** If the destructor was called, anotherList was destroyed ***\n";