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

<deque>: Use unchecked iterators #4071

Merged
merged 3 commits into from
Oct 6, 2023

Conversation

frederick-vs-ja
Copy link
Contributor

Fixes #2868.

Some changes are made for consistency, while they may be unnecessary as algorithms can unwrap checked iterators.

Driven-by changes:

  • introduce the _At member functions to make operator[], at, front, back, and _Insert_n clearer;
  • fix shrink_to_fit - previously it didn't support non-default-constructible allocators and might use a wrong memory resource denoted by the default-constructed allocator.

Driven-by changes
- introduce `_At` member functions to make some other members clearer
- fix `shrink_to_fit`
@frederick-vs-ja frederick-vs-ja requested a review from a team as a code owner October 5, 2023 07:11
@CaseyCarter CaseyCarter added the bug Something isn't working label Oct 5, 2023
@StephanTLavavej StephanTLavavej self-assigned this Oct 5, 2023
stl/inc/deque Outdated Show resolved Hide resolved
stl/inc/deque Outdated Show resolved Hide resolved
@StephanTLavavej StephanTLavavej removed their assignment Oct 5, 2023
@StephanTLavavej
Copy link
Member

Thanks! I think one maintainer approval is sufficient here.

@StephanTLavavej
Copy link
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit 78f5939 into microsoft:main Oct 6, 2023
35 checks passed
@StephanTLavavej
Copy link
Member

Thanks for noticing and fixing this bug, and making deque behave more like the other containers with unchecked iterators! 🃏 💳 🎴

@frederick-vs-ja frederick-vs-ja deleted the deque-unchecked branch October 6, 2023 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

<deque>: many internal operations could use unchecked iterators
3 participants