Why am I getting a Vector iterator is not incrementable
error in this code?
for (vector<vector<Point>>::iterator it = contours.begin(); it != contours.end(); ++it) {
if (contourArea(*it) < 50) {
it = contours.erase(it);
}
}
The other answers I looked at said to solve this error by assigning the iterator that .erase()
returns to it
, but I'm still getting the same error. What's wrong?