Fix layout stride converting explicit clause#445
Merged
crtrott merged 4 commits intokokkos:stablefrom Jan 28, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request fixes the layout_stride converting constructor to properly handle conversions from padded layouts (layout_left_padded and layout_right_padded). The fix ensures that conversions from padded layouts to layout_stride are implicit (when extents are convertible), consistent with how conversions from layout_left, layout_right, and layout_stride itself are handled.
Changes:
- Added include for
layout_padded_fwd.hppto access padded layout type traits - Extended the
MDSPAN_CONDITIONAL_EXPLICITclause to include padded layout mappings in the list of layouts that should have implicit conversion - Added compile-time tests to verify constructibility, convertibility, and assignability for conversions between
layout_strideand padded layouts
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
include/experimental/__p0009_bits/layout_stride.hpp |
Added include for padded layout traits and extended the converting constructor's explicit clause to handle padded layouts |
compilation_tests/ctest_layout_convertible.cpp |
Added compile-time tests (guarded with C++17 check) to verify bidirectional conversion support between layout_stride and padded layouts |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
crtrott
requested changes
Jan 27, 2026
crtrott
approved these changes
Jan 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We forgot to add the padded layouts to the
layout_strideconverting constructor, see https://eel.is/c++draft/mdspan.layout#stride.cons-9This PR adds tests for all the strided layout conversions/constructions/assignments from other layouts