Comparison operators of layout_stride
don't seem to work correctly #196
Closed
Description
Looks like the comparison operators of layout_stride
don't work correctly when the extents are different but the strides are the same. See example for operator==
here https://godbolt.org/z/Pc9o57xhq or below:
#include <https://raw.githubusercontent.com/kokkos/mdspan/single-header/mdspan.hpp>
#include <array>
namespace stdex = std::experimental;
int main() {
constexpr auto dyn = stdex::dynamic_extent;
{
using index_t = size_t;
using ext2d_t = stdex::extents<index_t,dyn,dyn>;
stdex::extents<index_t,16,32> e0;
stdex::extents<index_t,16,64> e1;
std::array<index_t,2> a{1,16};
stdex::layout_stride::mapping<ext2d_t> m0{e0, a};
stdex::layout_stride::mapping<ext2d_t> m1{e1, a};
assert( ( m0.extents() == m1.extents() ) == false );
assert( ( m0 == m1 ) == true );
}
return 0;
}
Both _eq_impl
and _not_eq_impl
only check stride
and don't check extent
.