Skip to content

Conversation

@frederick-vs-ja
Copy link
Contributor

Closes #4166.

I believe the original implementation is conforming after LWG-3974, because the difference between index-cast and static_cast can't be observed without UB (precondition violation). This PR intends to improve precondition checking.

@frederick-vs-ja frederick-vs-ja requested a review from a team as a code owner November 22, 2023 15:56
@StephanTLavavej StephanTLavavej added LWG Library Working Group issue mdspan C++23 mdspan labels Nov 27, 2023
@StephanTLavavej StephanTLavavej self-assigned this Nov 27, 2023
Copy link
Contributor

@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.

Just a static_assert message nit, which I'll apply.

I believe the original implementation is conforming after LWG-3974, because the difference between index-cast and static_cast can't be observed without UB (precondition violation).

That was my determination as well when LWG suggested changing the resolution to use index-cast.

Clarify `static_assert` message.
@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 c9d52cd into microsoft:main Nov 29, 2023
@StephanTLavavej
Copy link
Member

Thanks for improving mdspan and resolving this LWG issue! 🎉 🚀 😺

@frederick-vs-ja frederick-vs-ja deleted the lwg-3974 branch November 29, 2023 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LWG Library Working Group issue mdspan C++23 mdspan

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LWG-3974 mdspan::operator[] should not copy OtherIndexTypes

3 participants