I have a class member variable like this:
vector > m_stacks;
When I populate it, I do like this:
v
The std::vector
destructor calls a delete on the memory it allocates, thereby calling that types (in this instance, a std::vector
's) destructor.
These data structures all rely on SBRM (Scope bound resource management), or RAII (Resource acquisition is initialisation) principles, in that all memory they allocate is de-allocated once they go out of scope (such as the scope of a class).
You do not need to worry about the releasing of memory from a std::vector
unless it holds a type which points to memory; but does not release it inherently (such as a pointer!).