c++ deleting vector class member memory in destructor

前端 未结 4 2049
天涯浪人
天涯浪人 2021-01-19 16:42

I have a class containing a vector member variable. I know that vectors stored on the stack will be cleaned up (i.e. memory free\'d) when they go out of scope, but I\'m not

4条回答
  •  抹茶落季
    2021-01-19 17:23

    I think you need not call DTOR for the vector. The DTOR will be called as soon as the object goes out of scope, meaning the DTOR of fred is Called.

提交回复
热议问题