-
it's not fun, don't do it
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?
-
i n v i s i b l e
Tech Admin
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
-
Forum Rules