`The straight answer is:
for (vector< pair<int, object*> >::iterator it = vectorObject.begin(); it != vectorObject.end(); ++it) {
delete it->second;
}
But. You should probably not be doing this.
Having unmanged pointers is a BAD idea. You should change the type of the vector to use std::unique_ptr
.
vector< pair<int, std::unique_ptr<object>>> vectorObject;
This is because manually deleting objects is error prone and unless you take safeguards (by uisng RAII) NOT exception safe.