Implement (chunk_view<forward>|stride_view)::iterator::operator(\+=|-=) in O(1)#3023
Merged
Merged
Conversation
…-=)` in O(1) Speculatively implements what will be the proposed resolution of an LWG issue filed per microsoftGH-2995 once the new working draft is out with `stride_view` and `chunk_view`. Also avoid checking the precondition when it can't be done in O(1). Drive-by: * inline `ranges::advance(i, n)` since it's simply `i += n` for random-access iterators * check for overflow of `-n` when calling `*this += -n` in `operator-=` Partially addresses microsoft#2995
(chunk_view<forward>|stride_view)::iterator::operator(\+=|-=) in O(1)
StephanTLavavej
approved these changes
Aug 11, 2022
StephanTLavavej
approved these changes
Aug 11, 2022
cpplearner
reviewed
Aug 11, 2022
Co-authored-by: S. B. Tam <[email protected]>
StephanTLavavej
approved these changes
Aug 11, 2022
Member
|
Thanks @cpplearner - as both sites require |
Member
|
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
Member
|
Thanks for fixing chunks of this bug and helping the STL stride forward into a new era! 😹 👟 🚀 |
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.
Speculatively implements what will be the proposed resolution of an LWG issue filed per GH-2995 once the new working draft is out with
stride_viewandchunk_view. Also avoid checking the precondition when it can't be done in O(1).Drive-by:
ranges::advance(i, n)since it's simplyi += nfor random-access iterators-nwhen calling*this += -ninoperator-=Partially addresses #2995