Skip to content

[ranges] Apply resolution of LWG3502 to elements_view - #1878

Merged
Stephan T. Lavavej (StephanTLavavej) merged 4 commits into
microsoft:mainfrom
miscco:lwg3502
May 1, 2021
Merged

Stephan T. Lavavej (StephanTLavavej) merged 4 commits into
microsoft:mainfrom
miscco:lwg3502

Conversation

@miscco

Copy link
Copy Markdown
Contributor

Fixes #1685

Comment thread stl/inc/ranges Outdated
_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
Copy Markdown
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

Comment thread stl/inc/ranges Outdated
Comment thread tests/std/tests/P0896R4_views_elements/test.cpp Outdated
Comment thread stl/inc/ranges Outdated
Comment thread stl/inc/ranges Outdated
Comment thread stl/inc/ranges
Comment thread stl/inc/ranges
Comment thread tests/std/tests/P0896R4_views_elements/test.cpp Outdated
Comment thread tests/std/tests/P0896R4_views_elements/test.cpp Outdated
@CaseyCarter

Copy link
Copy Markdown
Contributor

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 Casey Carter (CaseyCarter) removed their assignment Apr 29, 2021
Comment thread stl/inc/ranges Outdated
Comment thread stl/inc/ranges
@StephanTLavavej
Stephan T. Lavavej (StephanTLavavej) merged commit 4946c74 into microsoft:main May 1, 2021
@StephanTLavavej

Copy link
Copy Markdown
Member

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

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