L
linq936
Hi,
The following is a psudo code to describe my question:
vector<int> ints;
vector<int>::iterator itr;
while (itr != ints.end()){
int j = some_function(*i);
if (j>0){
ints.push_back(j);
}
ints.erase(itr);
}
Can it work? I dynamically add new element into a vector while I am
looping the vector.
The following is a psudo code to describe my question:
vector<int> ints;
vector<int>::iterator itr;
while (itr != ints.end()){
int j = some_function(*i);
if (j>0){
ints.push_back(j);
}
ints.erase(itr);
}
Can it work? I dynamically add new element into a vector while I am
looping the vector.