O
Ook
I have a set<Item*> that I use in a class, Item being one of my classes. In
the destructor, I want to iterate through the set and remove the elements so
there are no memory leaks. Is this the correct way to do it?
for( set<Item*>::iterator iterator = ItemSet.begin(); iterator !=
ItemSet.end(); iterator++)
{
delete *iterator;
}
the destructor, I want to iterate through the set and remove the elements so
there are no memory leaks. Is this the correct way to do it?
for( set<Item*>::iterator iterator = ItemSet.begin(); iterator !=
ItemSet.end(); iterator++)
{
delete *iterator;
}