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?
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?
You could loop through the vector and call delete(*element) (or free(), remove() or erase()) on each element.