deleting dynamically allocated object that contains vector in C++ STL

前端 未结 4 613
闹比i
闹比i 2021-01-23 22:12

I have a class

class ChartLine{

protected:
        vector line; // points connecting the line
        CString name; //line name for legend                 


        
4条回答
  •  闹比i
    闹比i (楼主)
    2021-01-23 22:41

    Yes, when a vector is destroyed, all the objects in the vector are destroyed. From the looks of things, your code should work as-is (though assuming the CString is the MFC one, some older versions of it had some memory leaks...)

提交回复
热议问题