Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change for loop to while loop. #663

Merged

Conversation

mdgrogan
Copy link
Contributor

@mdgrogan mdgrogan commented Dec 3, 2019

Change for loop to a while loop so that we don't skip items and overshoot the end of the container when erasing.

@matt-attack
Copy link
Contributor

matt-attack commented Dec 3, 2019

Nevermind. Discussion cleared this up.

@danthony06
Copy link
Contributor

danthony06 commented Dec 3, 2019 via email

@mdgrogan
Copy link
Contributor Author

mdgrogan commented Dec 3, 2019

Where does that occur?

@danthony06
Copy link
Contributor

danthony06 commented Dec 4, 2019 via email

@mdgrogan
Copy link
Contributor Author

mdgrogan commented Dec 4, 2019

Ah, no worries. The erase function returns the next iterator and at the end of the for loop, that iterator will be incremented again. So it potentially skips items and increments the iterator past end.

@pjreed pjreed merged commit 74c65a2 into swri-robotics:master Jan 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants