vector<int>::iterator it = array.begin();
while(it != array.end()) {
it = array.erase(it);
}
これじゃ駄目なのか?