Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
22 changes: 21 additions & 1 deletion compilation_tests/ctest_layout_convertible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,24 @@ MDSPAN_STATIC_TEST(
!std::is_constructible<LS1, NotARealLayout::mapping<E2>>::value
);


MDSPAN_STATIC_TEST(std::is_constructible<LS1, Kokkos::layout_left::mapping<E1>>::value);
MDSPAN_STATIC_TEST(std::is_convertible<Kokkos::layout_left::mapping<E1>, LS1>::value);
MDSPAN_STATIC_TEST(std::is_assignable<LS1, Kokkos::layout_left::mapping<E1>>::value);
Comment thread
nmm0 marked this conversation as resolved.

MDSPAN_STATIC_TEST(std::is_constructible<LS1, Kokkos::layout_right::mapping<E1>>::value);
MDSPAN_STATIC_TEST(std::is_convertible<Kokkos::layout_right::mapping<E1>, LS1>::value);
MDSPAN_STATIC_TEST(std::is_assignable<LS1, Kokkos::layout_right::mapping<E1>>::value);

MDSPAN_STATIC_TEST(std::is_constructible<LS1, Kokkos::layout_stride::mapping<E1>>::value);
MDSPAN_STATIC_TEST(std::is_convertible<Kokkos::layout_stride::mapping<E1>, LS1>::value);
MDSPAN_STATIC_TEST(std::is_assignable<LS1, Kokkos::layout_stride::mapping<E1>>::value);

#if MDSPAN_HAS_CXX_17
MDSPAN_STATIC_TEST(std::is_constructible<LS1, Kokkos::Experimental::layout_left_padded<14>::mapping<E1>>::value);
MDSPAN_STATIC_TEST(std::is_convertible<Kokkos::Experimental::layout_left_padded<14>::mapping<E1>, LS1>::value);
MDSPAN_STATIC_TEST(std::is_assignable<LS1, Kokkos::Experimental::layout_left_padded<14>::mapping<E1>>::value);

MDSPAN_STATIC_TEST(std::is_constructible<LS1, Kokkos::Experimental::layout_right_padded<14>::mapping<E1>>::value);
MDSPAN_STATIC_TEST(std::is_convertible<Kokkos::Experimental::layout_right_padded<14>::mapping<E1>, LS1>::value);
MDSPAN_STATIC_TEST(std::is_assignable<LS1, Kokkos::Experimental::layout_right_padded<14>::mapping<E1>>::value);
#endif
6 changes: 6 additions & 0 deletions include/experimental/__p0009_bits/layout_stride.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
#include "compressed_pair.hpp"
#include "utility.hpp"

#if MDSPAN_HAS_CXX_17
#include "../__p2642_bits/layout_padded_fwd.hpp"
Comment thread
nmm0 marked this conversation as resolved.
#endif

#if !defined(MDSPAN_IMPL_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
# include "no_unique_address.hpp"
#endif
Expand Down Expand Up @@ -441,6 +445,8 @@ struct layout_stride {
!(std::is_convertible<typename StridedLayoutMapping::extents_type, extents_type>::value &&
(detail::is_mapping_of<layout_left, StridedLayoutMapping> ||
detail::is_mapping_of<layout_right, StridedLayoutMapping> ||
MDSPAN_IMPL_PROPOSED_NAMESPACE::detail::is_layout_left_padded_mapping<StridedLayoutMapping>::value || // Don't need to guard for C++14 as this isn't compiled in < C++20
MDSPAN_IMPL_PROPOSED_NAMESPACE::detail::is_layout_right_padded_mapping<StridedLayoutMapping>::value ||
detail::is_mapping_of<layout_stride, StridedLayoutMapping>))
) // needs two () due to comma
MDSPAN_INLINE_FUNCTION MDSPAN_IMPL_CONSTEXPR_14
Expand Down