How to deallocate object pointer in vector?

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

I have ;

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

};
<
7条回答
  •  孤独总比滥情好
    2021-02-06 13:21

    You can simply call delete tmp[i];. But I would recommend to use std::vector< std::shared_ptr< object > > instead.

提交回复
热议问题