How to deallocate object pointer in vector?

后端 未结 7 1379
野趣味
野趣味 2021-02-06 12:30

I have ;

class object {
                    // any private datas token in heap area 
             public : 
                   ~object () ; 

};
<
7条回答
  •  盖世英雄少女心
    2021-02-06 13:08

    To delete the object on the end of that pointer, call delete myVector[i]

    To then remove that pointer from in the vector, call myVector.erase(myVector.begin()+i)

提交回复
热议问题