On 11/6/2016 8:04 PM, Popping mad wrote:
>
> Since we can't just delete a vector, do I need to deallocate it when we
> call a destructor? I think I do, but I don't know how.
>
I am not sure what you are referring to when you say "deallocate it" It
is best to not use any pronouns at all, imo, when talking programmin.
Like every class, std::vector has its own deconstructor that is called
when it goes out of scope. The deconstructor will clean up any memory
the vector used internally.
However, if the objects the vector contains, used any memory themselves,
then those objects are responsible for cleaning up that memory.
If you allocated things yourself and put those things into the vector,
then you are going to be responsible for releasing them as well.