dose vector.erase() call destructor
if you have a vector of objects and call erase on one of them dose it call the destuctor?
thanks[grin]
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.
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)
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)
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).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement