https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111717

--- Comment #1 from 康桓瑋 <hewillk at gmail dot com> ---
#include <utility>

namespace std {
constexpr size_t dynamic_extent = -1;

template<class IndexType, size_t... Extents>
class extents { };

template<class IndexType, size_t Rank>
using dextents = decltype([]<size_t... Is>(index_sequence<Is...>) {
  return extents<IndexType, ((void)Is, dynamic_extent)...>{};
}(make_index_sequence<Rank>{}));

// this works well
static_assert(std::is_same_v<
  dextents<int, 3>,
  extents<int, dynamic_extent, dynamic_extent, dynamic_extent>>
);

template<class ElementType, class Extents>
class mdspan {
  template<class Ptr, class... Integrals>
  explicit mdspan(Ptr ptr, Integrals... exts);
};

template<class ElementType, class... Integrals>
explicit mdspan(ElementType*, Integrals...)
  ->mdspan<ElementType, dextents<size_t, sizeof...(Integrals)>>;

}

https://godbolt.org/z/E45dcb4G8

Reply via email to