Skip to content
Snippets Groups Projects
Commit a7da5ef8 authored by Christoph Grüninger's avatar Christoph Grüninger
Browse files

Merge branch 'issue/mdarray-to-mdspan' into 'master'

Fix mdspan converting constructor

See merge request !1522
parents 8533a2f6 7c72f546
No related branches found
No related tags found
1 merge request!1522Fix mdspan converting constructor
Pipeline #77774 waiting for manual action
......@@ -168,10 +168,10 @@ public:
/// \brief Converting constructor
template <class OtherElementType, class OtherExtends, class OtherLayoutPolicy, class OtherAccessor,
std::enable_if_t<std::is_constructible_v<mapping_type, const typename OtherElementType::template mapping<OtherExtends>&>, int> = 0,
std::enable_if_t<std::is_constructible_v<mapping_type, const typename OtherLayoutPolicy::template mapping<OtherExtends>&>, int> = 0,
std::enable_if_t<std::is_constructible_v<accessor_type, const OtherAccessor&>, int> = 0>
#if __cpp_conditional_explicit >= 201806L
explicit(!std::is_convertible_v<const typename OtherElementType::template mapping<OtherExtends>&, mapping_type>
explicit(!std::is_convertible_v<const typename OtherLayoutPolicy::template mapping<OtherExtends>&, mapping_type>
|| !std::is_convertible_v<const OtherAccessor&, accessor_type>)
#endif
constexpr mdspan (const mdspan<OtherElementType,OtherExtends,OtherLayoutPolicy,OtherAccessor>& other) noexcept
......
......@@ -83,6 +83,11 @@ void test_accessor (Dune::TestSuite& testSuite, std::string name, const M& mappi
else if constexpr(Span::rank() == 3)
Span span5{dh, e.extent(0), e.extent(1), e.extent(2)};
// converting constructor
using OtherExtents = Dune::Std::dextents<std::size_t, Span::rank()>;
using OtherSpan = Dune::Std::mdspan<typename A::element_type, OtherExtents, typename M::layout_type, A>;
OtherSpan otherSpan(span4);
checkAccess(subTestSuite, span2);
testSuite.subTest(subTestSuite);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment