How to release std::vector if there is no heap memory

前端 未结 3 818
不知归路
不知归路 2021-01-18 05:13

I have a class member variable like this:

vector >  m_stacks;

When I populate it, I do like this:

v         


        
3条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-18 06:02

    You don't have to do anything for m_stacks (a class data member). Acquired memory will be released automatically when the class destructor will be called. This is the purpose for which std::vector is used.

提交回复
热议问题