mdspan: Using `layout_stride` directly is horrific
@crtrott is already working on this.
Since Aug 5, 2019.
- Dominant language
- HTML
- Stars
- 29
- Forks
- 26
- PR merge metrics
- No merged PRs in 30d
Description
For instance, the constructor requires you to repeat the extents three times. For a 4D mdspan with sizes 20, dynamic, 40, dynamic, this looks like:
auto s =
std::basic_mdspan<
int, std::extents<20, std::dynamic_extent, 40, std::dynamic_extent>, std::layout_stride
>(
ptr,
std::layout_stride::mapping<
std::extents<20, std::dynamic_extent, 40, std::dynamic_extent>
>(
std::extents<20, std::dynamic_extent, 40, std::dynamic_extent>{30, 50},
std::array<ptrdiff_t, 4>{1, 20, 600, 2400}
)
);
Either we should have some extension to the mdspan constructors that makes this friendlier or we should make layout_stride an implementation detail of subspan for now. Either of these options are fine—layout_stride doesn't need to be in the first version if it's this difficult to use (subspan can just return an implementation-defined layout, which it should probably do anyway).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.