Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stl/inc/mdspan
Original file line number Diff line number Diff line change
Expand Up @@ -1550,7 +1550,7 @@ mdspan(_ElementType*, const _MappingType&)
-> mdspan<_ElementType, typename _MappingType::extents_type, typename _MappingType::layout_type>;

template <class _MappingType, class _AccessorType>
mdspan(const typename _AccessorType::data_handle_type&, const _MappingType&, const _AccessorType&)
mdspan(typename _AccessorType::data_handle_type, const _MappingType&, const _AccessorType&)
-> mdspan<typename _AccessorType::element_type, typename _MappingType::extents_type,
typename _MappingType::layout_type, _AccessorType>;

Expand Down
10 changes: 9 additions & 1 deletion tests/std/tests/P0009R18_mdspan_mdspan/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1329,11 +1329,19 @@ constexpr void check_deduction_guides() {
static_assert(same_as<decltype(mds2), mdspan<const long, dextents<int, 3>, layout_stride>>);
}

{ // const typename AccessorType::data_handle_type&, const MappingType&, const AccessorType&
{ // typename AccessorType::data_handle_type, const MappingType&, const AccessorType&
vector<bool> bools = {true, false, true, false};
mdspan mds{bools.begin(), TrackingLayout<>::mapping<extents<int, 2, 2>>(1), VectorBoolAccessor{}};
static_assert(same_as<decltype(mds), mdspan<bool, extents<int, 2, 2>, TrackingLayout<>, VectorBoolAccessor>>);
}

if !consteval { // typename AccessorType::data_handle_type, const MappingType&, const AccessorType&
// (with volatile data_handle_type, per LWG-4511)
int a[1]{};
int* volatile p = a;
mdspan mds{p, layout_right::mapping<std::extents<std::size_t, 1>>{}, default_accessor<int>{}};
static_assert(same_as<decltype(mds), mdspan<int, extents<size_t, 1>>>);
}
}

constexpr bool test() {
Expand Down