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

[ranges] Apply resolution of LWG3502 to elements_view #1878

Merged
merged 4 commits into from
May 1, 2021

Conversation

miscco
Copy link
Contributor

@miscco miscco commented Apr 23, 2021

Fixes #1685

@miscco miscco requested a review from a team as a code owner April 23, 2021 10:19
stl/inc/ranges Outdated
@@ -3768,7 +3772,12 @@ namespace ranges {

_NODISCARD constexpr decltype(auto) operator*() const
noexcept(noexcept(_STD get<_Index>(*_Current))) /* strengthened */ {
return _STD get<_Index>(*_Current);
if constexpr (is_reference_v<range_reference_t<_Base>>) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that I decided against implementing the exposition only get-element method

stl/inc/ranges Outdated Show resolved Hide resolved
@StephanTLavavej StephanTLavavej added the LWG Library Working Group issue label Apr 23, 2021
@CaseyCarter CaseyCarter self-assigned this Apr 28, 2021
stl/inc/ranges Outdated Show resolved Hide resolved
stl/inc/ranges Outdated Show resolved Hide resolved
stl/inc/ranges Show resolved Hide resolved
stl/inc/ranges Show resolved Hide resolved
tests/std/tests/P0896R4_views_elements/test.cpp Outdated Show resolved Hide resolved
tests/std/tests/P0896R4_views_elements/test.cpp Outdated Show resolved Hide resolved
@CaseyCarter
Copy link
Member

FYI: I've pushed a commit that fixes non-functional nitpicks in the test code, a bug in the conditional noexcept (detailed in #1878 (comment)), and pulls using _ElemTy = tuple_element_t<_Index, range_value_t<_Base>>; out into class scope to simplify the conditional noexcepts.

@CaseyCarter CaseyCarter removed their assignment Apr 29, 2021
stl/inc/ranges Outdated Show resolved Hide resolved
@StephanTLavavej StephanTLavavej self-assigned this Apr 30, 2021
stl/inc/ranges Show resolved Hide resolved
@StephanTLavavej StephanTLavavej merged commit 4946c74 into microsoft:main May 1, 2021
@StephanTLavavej
Copy link
Member

Thanks for implementing this LWG issue resolution! All shall love conformance and despair! 😻 ✔️ 🚀

@miscco miscco deleted the lwg3502 branch May 17, 2021 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LWG Library Working Group issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LWG-3502 elements_view should not be allowed to return dangling references
5 participants