3 ms·
In this case, where it is erasing one of the container elements inside the loop, the range-based loop would not be right. But the code is busted anyway. After
by ncmncm 4y ago
In this case, where it is erasing one of the container elements inside the loop, the range-based loop would not be right.
But the code is busted anyway. After it erases the pipe (which is always at index zero) it then skips the pipe that was at index 1, if there was one.
Correct would be to do the check and erase before entering the loop. Then the range-based loop would better.