[hive.erasure]/2 Have erase_if reevaluate end() LWG4318#8162
Closed
birbacher wants to merge 1 commit intocplusplus:mainfrom
Closed
[hive.erasure]/2 Have erase_if reevaluate end() LWG4318#8162birbacher wants to merge 1 commit intocplusplus:mainfrom
birbacher wants to merge 1 commit intocplusplus:mainfrom
Conversation
The defining code must not cache the end-iterator. In case the last element of the sequence is removed, the past-the-end iterator will be invalidated. This will trigger UB in the loop condition. Instead, re-evaluate end() each time.
Contributor
|
This seems like a normative change. @jwakely? |
Contributor
Author
|
At least it doesn't change the intended behaviour, I'd say. But if you reject, we'll file it as an NB comment. |
Contributor
|
I don't want to make that call unilaterally, but if there's agreement from LWG that it's an obvious oversight, I'd be OK to handle it editorially. |
Member
|
This seems badly normative to me, the current code is broken and avoiding repeated calls to Please just file an LWG issue, there's no reason to wait for the NB ballot. |
Member
|
We have now LWG 4318 for this. |
Contributor
|
Thanks, Daniel! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The defining code must not cache the end-iterator. In case the last element of the sequence is removed, the past-the-end iterator will be invalidated. This will trigger UB in the loop condition. Instead, re-evaluate end() each time.