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

<vector>: More scope guards #4977

Merged
merged 3 commits into from
Oct 12, 2024

Conversation

frederick-vs-ja
Copy link
Contributor

Towards #2307. Possibly closes it?

There're still two occurrences of try-catch-reraise in _Insert_counted_range, which don't seem able to be replaced by scope guards if we want to keep the current behavior. It seems that no more _RERAISE; in other headers can be replaced with scope guards.

Drive-by: strengthening exception specification for

  • allocator<T>::deallocate,
  • allocator_traits<allocator<T>>::deallocate, and
  • vector<T, A>::_Change_array.

@frederick-vs-ja frederick-vs-ja requested a review from a team as a code owner September 23, 2024 11:41
@frederick-vs-ja frederick-vs-ja force-pushed the vector-scope-guards branch 2 times, most recently from 3a167a2 to dbd409f Compare September 23, 2024 12:03
There're still two occurrences of try-catch-reraise in
`_Insert_counted_range`, which don't seem able to be replaced by scope
guards if we want to keep the current behavior. It seems that no more
`_RERAISE;` in other headers can be replaced with scope guards.

Drive-by: strengthening exception specification for
- `allocator<T>::deallocate`,
- `allocator_traits<allocator<T>>::deallocate`, and
- `vector<T, A>::_Change_array`.
@CaseyCarter CaseyCarter added the enhancement Something can be improved label Sep 23, 2024
@StephanTLavavej StephanTLavavej self-assigned this Sep 23, 2024
stl/inc/vector Show resolved Hide resolved
stl/inc/vector Outdated Show resolved Hide resolved
@StephanTLavavej
Copy link
Member

Thanks, this is a very clean transformation! 🪄 I pushed a conflict-free merge with main and reordered one guard member.

@StephanTLavavej StephanTLavavej removed their assignment Oct 3, 2024
@StephanTLavavej StephanTLavavej self-assigned this Oct 11, 2024
@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 b2b57e0 into microsoft:main Oct 12, 2024
39 checks passed
@StephanTLavavej
Copy link
Member

Thanks again for improving the STL's bestest data structure! 💯 ⭐ 💚

@frederick-vs-ja frederick-vs-ja deleted the vector-scope-guards branch October 12, 2024 06:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Something can be improved
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants