Skip to content

P2281R1 Clarifying Range Adaptor Objects - #2197

Merged
Stephan T. Lavavej (StephanTLavavej) merged 4 commits into
microsoft:mainfrom
CaseyCarter:p2281
Sep 25, 2021
Merged

Stephan T. Lavavej (StephanTLavavej) merged 4 commits into
microsoft:mainfrom
CaseyCarter:p2281

Conversation

@CaseyCarter

Copy link
Copy Markdown
Contributor

Which explicitly specifies that range adaptor closure objects are perfect-forwarding call wrappers, which are more fastidious about value categories of bound arguments than were our ad-hoc _Partially-applied functions.

Fixes #1983

@CaseyCarter Casey Carter (CaseyCarter) added cxx20 C++20 feature ranges C++20/23 ranges defect report Applied retroactively labels Sep 10, 2021
@CaseyCarter
Casey Carter (CaseyCarter) requested a review from a team as a code owner September 10, 2021 23:27
@CaseyCarter Casey Carter (CaseyCarter) changed the title Implement P2281 P2281R1 Clarifying Range Adaptor Objects Sep 10, 2021
@miscco

Copy link
Copy Markdown
Contributor

I am missing test for lazy_split_view and split_view which were the views where it does matter

Which explicitly specifies that range adaptor closure objects are perfect-forwarding call wrappers, which are more fastidious about value categories of bound arguments than were our ad-hoc `_Partial`ly-applied functions.

Fixes microsoft#1983
Comment thread stl/inc/ranges Outdated
Comment thread stl/inc/ranges Outdated
Comment thread stl/inc/ranges Outdated
Comment thread stl/inc/ranges Outdated
Comment thread tests/std/tests/P0896R4_ranges_range_machinery/test.cpp Outdated
Comment thread tests/std/tests/P0896R4_ranges_range_machinery/test.cpp Outdated
Comment thread tests/std/tests/P0896R4_ranges_range_machinery/test.cpp Outdated
Comment thread tests/std/tests/P0896R4_ranges_range_machinery/test.cpp Outdated
@CaseyCarter

Casey Carter (CaseyCarter) commented Sep 20, 2021

Copy link
Copy Markdown
Contributor Author

I am missing test for lazy_split_view and split_view which were the views where it does matter

Obviously there are quite a few test cases for each that are still working; what additionally would you like to see tested?

EDIT: I suppose the biggest difference is that lone lvalue arguments to views::split and views::lazy_split are now captured by copy instead of reference, so changes to the original object between capture and evaluation of the range closure won't be visible in the resulting view. Would you like a test for each that validates that difference?

Comment thread stl/inc/ranges Outdated
Comment thread stl/inc/ranges Outdated
@StephanTLavavej

Copy link
Copy Markdown
Member

I'm mirroring this to an MSVC-internal PR. Please notify me if any further changes are pushed.

@StephanTLavavej

Copy link
Copy Markdown
Member

I pushed a workaround for VSO-1409853 "Standard Library Header Units: <ranges> compiler assertion: previous_element == tokenInputStack.TopOfStack(), aliastemplates.cpp 1010".

@StephanTLavavej

Copy link
Copy Markdown
Member

Thanks for the clarification! 💡 🧠 😹

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cxx20 C++20 feature defect report Applied retroactively ranges C++20/23 ranges

Projects

None yet

Development

Successfully merging this pull request may close these issues.

P2281R1 Clarifying Range Adaptor Objects

4 participants