Closed ghost closed 9 years ago
the erased element is deleted in the erase function:
From http://www.cplusplus.com/reference/vector/vector/erase/:
Removes from the vector http://www.cplusplus.com/vector either a single element (position) or a range of elements ([first,last)).
This effectively reduces the container size http://www.cplusplus.com/vector::size by the number of elements removed, which are destroyed.
oh ok nevermind. Read the other link you sent me:
Removes from the vector container and calls its destructor but If the
contained object is a pointer it doesnt take ownership of destroying it.
fixed
every element which is erased from a vector of pointers should be deleted. see here: http://stackoverflow.com/questions/6353149/does-vectorerase-on-a-vector-of-object-pointers-destroy-the-object-itself