-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Fix unnecessary self-move-assignments on calling deque erase(x,x) #1148
Conversation
I believe the "conventional" solution would be to simply add if (_First == _Last) {
return _First;
} at the beginning of the function. |
Also note, that formatting seems to be off. You need to use clang-format 10 with the file setting |
It adds an additional IF statement to the code as well. This IF statement will be effective in just a rare call. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this!
I wonder whether we should have test coverage for this, but we can file a separate issue for that.
Thanks for fixing this bug, and congratulations on your first microsoft/STL commit! 🎉 😸 |
Fixes issue #1118
I think it's the simplest method to solve the issue. however, it adds a little bit overhead to the library with an additional IF.
Any better idea?