Properly destroying pointers in an std::map
As far as your sample code goes, you need to do this inside the loop: delete itr->second; The map has two elements and you need to delete the second. In your case, itr->first is a std::string and itr->second is a Texture*. If you need to delete a particular entry, you could do something like this: … Read more