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

Add element access via at() to std::mdspan #302

Open
wants to merge 1 commit into
base: stable
Choose a base branch
from

Conversation

stephanlachnit
Copy link
Contributor

Closes #300

Possible implementation for ::at element access to mdspan with boundary checks. The boundary check is implemented with a for loop, as I did not see any other way to achieve this. The error message is inspired by the std::span::at error message from libstdc++ (gcc-mirror/gcc@1fa85dc).

Note that this does not implement ::at element access to mdarray.

@stephanlachnit stephanlachnit changed the title add ::at element access to mdspan Add element access via at() to std::mdspan Nov 29, 2023
Signed-off-by: Stephan Lachnit <stephanlachnit@debian.org>
@stigrs
Copy link

stigrs commented Jan 24, 2024

Given that SizeTypes can be signed, it should also check for indices[r] < 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Access with bounds checking using ::at
3 participants