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

P1223R5: find_last, et al. #3268

Merged
merged 11 commits into from
Dec 15, 2022
Merged

P1223R5: find_last, et al. #3268

merged 11 commits into from
Dec 15, 2022

Conversation

SuperWig
Copy link
Contributor

@SuperWig SuperWig commented Dec 6, 2022

Fixes #2913.

I hope I'm doing the unwrapping, re-unwrapping stuff correctly.

@SuperWig SuperWig requested a review from a team as a code owner December 6, 2022 13:46
@StephanTLavavej StephanTLavavej added ranges C++20/23 ranges cxx23 C++23 feature labels Dec 6, 2022
tests/std/test.lst Outdated Show resolved Hide resolved
stl/inc/algorithm Outdated Show resolved Hide resolved
stl/inc/algorithm Outdated Show resolved Hide resolved
stl/inc/algorithm Outdated Show resolved Hide resolved
stl/inc/algorithm Show resolved Hide resolved
stl/inc/algorithm Outdated Show resolved Hide resolved
stl/inc/algorithm Outdated Show resolved Hide resolved
For find_last and find_last_if, this transformation is easy - add additional values with a `.second` component of `1729`, which allows us to verify that we always find the last one.

The find_last_if_not test was following the existing find_if_not test, but that's difficult to adapt to "make sure we find the last one". So I've simply taken the find_last_if test and inverted the predicates - not not cat is cat.
stl/inc/algorithm Outdated Show resolved Hide resolved
stl/inc/algorithm Outdated Show resolved Hide resolved
tests/std/tests/P1223R5_ranges_alg_find_last/test.cpp Outdated Show resolved Hide resolved
stl/inc/algorithm Outdated Show resolved Hide resolved
stl/inc/algorithm Outdated Show resolved Hide resolved
stl/inc/algorithm Outdated Show resolved Hide resolved
stl/inc/algorithm Outdated Show resolved Hide resolved
stl/inc/algorithm Outdated Show resolved Hide resolved
stl/inc/algorithm Outdated Show resolved Hide resolved
tests/std/tests/P1223R5_ranges_alg_find_last/test.cpp Outdated Show resolved Hide resolved
tests/std/tests/P1223R5_ranges_alg_find_last/test.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@strega-nil-ms strega-nil-ms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the auto and the DRY change, looks really good!

stl/inc/algorithm Outdated Show resolved Hide resolved
stl/inc/algorithm Outdated Show resolved Hide resolved
stl/inc/algorithm Outdated Show resolved Hide resolved
@StephanTLavavej StephanTLavavej self-assigned this Dec 15, 2022
@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 f1e026f into microsoft:main Dec 15, 2022
@StephanTLavavej
Copy link
Member

Thanks for implementing these ranges algorithms! 🐱 🐈 🐈‍⬛ 😻

@SuperWig SuperWig deleted the find_last branch December 19, 2022 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cxx23 C++23 feature ranges C++20/23 ranges
Projects
None yet
Development

Successfully merging this pull request may close these issues.

P1223R5 ranges::find_last, ranges::find_last_if, ranges::find_last_if_not
5 participants