Results 1 to 2 of 2

Thread: Vectors of pointers (C++)

  1. #1
    it's not fun, don't do it Moon Rabbits's Avatar
    Join Date
    Mar 2005
    Posts
    5,582

    Default Vectors of pointers (C++)

    How do I free the memory allocated for a vector of pointers? Because using the erase() function only deletes the vector entry, not the actual pointer. What is an efficient way to go about doing this?

  2. #2
    i n v i s i b l e Tech Admin o_O's Avatar
    Join Date
    Jun 2001
    Location
    New Zealand
    Posts
    2,957
    Blog Entries
    1

    FFXIV Character

    Humphrey Squibbles (Sargatanas)

    Default

    You could loop through the vector and call delete(*element) (or free(), remove() or erase() ) on each element.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •