All pastes #957779 Raw Edit

Something

public text v1 · immutable
#957779 ·published 2008-03-26 05:24 UTC
rendered paste body
vector<Foo*> tehList;tehList.push_back(new Foo());tehList.push_back(new Foo());tehList.push_back(new Foo());tehList.push_back(new Foo());tehList.push_back(new Foo());//we can only use erase() with an iteratorvector<Foo*>::iterator it = tehList.begin();delete *(it[2]);tehList.erase(it[2]);//tehList[2] is now what used to be tehList[3], and the old [2] was deallocated.Foo* aFoo = tehList[0];//it's an array of foo pointers//before doing delete tehList, you have to make sure all its elements were//deleted too.