Sign in to follow this  
raptorstrike

dose vector.erase() call destructor

Recommended Posts

Guest Anonymous Poster
But if you're using a vector of pointers (as you have in your earlier examples today) it doesn't delete the objects (or run their destructors) - it just kills the pointers.

Share this post


Link to post
Share on other sites
lol youve been doing some reading eh?
i figured as much about the pointers.
thanks[smile]

(yeah i have alot of vector posts for today after i decided that i should make all my 1d arrays vectors, the conversion was a little messy but i learned alot and it all works properly now)

Share this post


Link to post
Share on other sites
Also, remember that the vector *copies* your object upon insertion, so the original (assuming heap allocation) does not get deleted (and thus does not have its destructor called).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this