我想知道我是否应该明确地取消分配通过 myvector.erase() 从向量中擦除的指针;.
例如;
Class Sample1{
public:
removeSample2(Sample2 * a)
{
if(// if i find that a is in my sampleList1 vector with index i ){
// should i call here delete or something like that for a pointer ?
sampleList1.erase(sampleList1.begin()+i);
}
}
private:
vector<Int *> sampleList1;
}
Class Sample2{
public:
// not important areas
private:
Sample1 * example;
}