vector<vector<void*>::iterator> v2; for (vector<void*>::iterator it = v.begin(); it != v.end(); ++it) { if ( /* it はもう必要ないなら*/ ) { v2.push_back(it); delete (*it); } }
for (vector<vector<void*>::iterator>::iterator it = v2.begin(); it != v2.end(); ++it) v.erase(*it);