Thread: STL map and dynamic memory

  1. #16
    Registered User
    Join Date
    Feb 2005
    Thanks for the replies, Yeah its all fixed. The AnimFile* wasnt really necessary as value worked just fine. That and the use of the string class solved problems.

    ohh and yes just irtating through the map deleting all dynamic memory then callng clear() worked.
    Last edited by Ted_Striker; 02-15-2005 at 05:33 PM.

  2. #17
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    @ AH_Tze:

    Indeed, that's what I meant (although perhaps I wasn't clear). List and vector (probably deque too) all have mechanisms by which you can erase an element and continue looping; with map, as far as I can tell, if you erase an element then there is no way to get an iterator for the next element and therefore you must start over from the beginning again. In this case, it seems that would be a simple thing to do - since every element is deleted, the 'next' element is always the first element, so begin() should suffice to provide you with suitable iterators.

    Come to think about it, my post has less and less meaning every time I read through it
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. memory leaks
    By TehOne in forum C Programming
    Replies: 4
    Last Post: 10-10-2008, 09:33 PM
  2. Replies: 2
    Last Post: 09-28-2006, 01:06 PM
  3. How do you search a list container....
    By chadsxe in forum C++ Programming
    Replies: 22
    Last Post: 07-16-2005, 12:39 PM
  4. Using the map STL
    By Sethiorth in forum C++ Programming
    Replies: 2
    Last Post: 10-22-2003, 03:07 PM
  5. Dynamic memory
    By frenchfry164 in forum C++ Programming
    Replies: 10
    Last Post: 07-10-2002, 09:31 PM