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

Implement LWG-3737 take_view::sentinel should provide operator- #3320

Merged
merged 5 commits into from Jan 12, 2023

Conversation

frederick-vs-ja
Copy link
Contributor

Fixes #3223.

(counted_iterator<counted_iterator<T>> seems a bit messy. Should I add a prettier test case?)

@frederick-vs-ja frederick-vs-ja requested a review from a team as a code owner January 1, 2023 16:49
@CaseyCarter CaseyCarter added LWG Library Working Group issue ranges C++20/23 ranges labels Jan 2, 2023
@CaseyCarter CaseyCarter added this to Initial Review in Code Reviews via automation Jan 2, 2023
Copy link
Member

@CaseyCarter CaseyCarter left a comment

Choose a reason for hiding this comment

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

LGTM, just some style nits.

tests/std/tests/P0896R4_views_take/test.cpp Show resolved Hide resolved
tests/std/tests/P0896R4_views_take/test.cpp Outdated Show resolved Hide resolved
Code Reviews automation moved this from Initial Review to Work In Progress Jan 2, 2023
@CaseyCarter CaseyCarter moved this from Work In Progress to Final Review in Code Reviews Jan 2, 2023
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.

LGTM, although the utility of this LWG issue seems suspect to me lol (given that it only triggers when disable_sized_range<R> && sized_sentinel_for<S, I>)

@strega-nil-ms strega-nil-ms moved this from Final Review to Ready To Merge in Code Reviews Jan 3, 2023
@CaseyCarter
Copy link
Member

LGTM, although the utility of this LWG issue seems suspect to me lol (given that it only triggers when disable_sized_range<R> && sized_sentinel_for<S, I>)

More precisely, it's !sized_range<R> && sized_sentinel_for<sentinel_t<R>, iterator_t<R>>. Since ranges::size is smart enough to call begin and end an return the difference, this boils down to covering single-pass (not forward) ranges with sized_sentinel_for. IIRC I pointed this out to LWG and suggested closing as NAD, but LWG was convinced that it was worth doing "just in case" since the cost is a couple of small if constexpr branches.

stl/inc/ranges Outdated Show resolved Hide resolved
@StephanTLavavej
Copy link
Member

Thanks! Really appreciate the test case, especially when it's non-trivial to set up like this one.

@CaseyCarter @strega-nil-ms I pushed changes after you approved, to defend against min macroization.

@StephanTLavavej StephanTLavavej self-assigned this Jan 11, 2023
@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 c20a26b into microsoft:main Jan 12, 2023
Code Reviews automation moved this from Ready To Merge to Done Jan 12, 2023
@StephanTLavavej
Copy link
Member

Thanks for taking the STL to the next level of conformance! 📊 🎉 😹

@frederick-vs-ja frederick-vs-ja deleted the lwg-3737 branch January 12, 2023 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LWG Library Working Group issue ranges C++20/23 ranges
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

LWG-3737 take_view::sentinel should provide operator-
4 participants