KEMBAR78
`<mdspan>`: Implement missing precondition in `layout_stride::mapping<E>`'s constructor by JMazurkiewicz · Pull Request #5505 · microsoft/STL · GitHub
Skip to content

Conversation

@JMazurkiewicz
Copy link
Contributor

This PR:

  • Implements precondition described in [mdspan.layout.stride.cons]/4.3.
    • Unfortunately, we cannot check this precondition when one or more extents are equal to 0. For example:
    extents = [3, 0, 3, 0]
    strides = [1, 3, 1, 3]
    pairs = [(1, 3), (3, 0), (1, 3), (3, 0)] // these pairs satisfy our precondition
    after sorting = [(1, 3), (1, 3), (3, 0), (3, 0)] // false positive
    "Sorting" approach (presented in this PR) would fail, even though these values satisfy previously mentioned precondition.
  • Fixes incorrect strides in the test code.
  • Adds extra death tests.

@JMazurkiewicz JMazurkiewicz requested a review from a team as a code owner May 14, 2025 19:25
@github-project-automation github-project-automation bot moved this to Initial Review in STL Code Reviews May 14, 2025
@StephanTLavavej StephanTLavavej added enhancement Something can be improved mdspan C++23 mdspan labels May 14, 2025
@StephanTLavavej StephanTLavavej self-assigned this May 14, 2025
@StephanTLavavej StephanTLavavej removed their assignment May 15, 2025
@StephanTLavavej StephanTLavavej moved this from Initial Review to Ready To Merge in STL Code Reviews May 15, 2025
@StephanTLavavej StephanTLavavej moved this from Ready To Merge to Merging in STL Code Reviews May 16, 2025
@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 ad4bf41 into microsoft:main May 17, 2025
39 checks passed
@github-project-automation github-project-automation bot moved this from Merging to Done in STL Code Reviews May 17, 2025
@StephanTLavavej
Copy link
Member

Thanks for noticing and enhancing these debug checks! ❌ 🐞 😻

@JMazurkiewicz JMazurkiewicz deleted the mdspan/stride-precond branch May 19, 2025 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Something can be improved mdspan C++23 mdspan

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants