Hi fellow experts,

I wrote a paper based on this thread:

https://htmlpreview.github.io/?https://github.com/hewillk/mdspan-ctad/blob/main/mdspan-ctad.html

It is still in the draft stage so there may be parts that need to be considered. Any comments are welcome.

Hewill


Hewill Kang <hewillk@gmail.com> 於 2023年10月5日 週四 下午3:21寫道:

Hi fellow experts

I initially thought that

mdspan ms(ptr, integral_constant<size_t, 2>{}, integral_constant<size_t, 6>{});

would be deduced into mdspan<int, extents<size_t, 2, 6>>. However, as the current wording ([mdspan.mdspan.overview]), it is just mdspan<int, extents<size_t, dynamic_extent, dynamic_extent>>

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

I wonder, is it a more appropriate choice to set the corresponding extents's static values based on whether Integrals... is integral_constant? For example

mdspan ms(ptr, integral_constant<size_t, 2>{}, 
               integral_constant<size_t, 3>{}, 
               4,
               integral_constant<size_t, 5>{});

which will be deduced as mdspan<int, extents<size_t, 2, 3, dynamic_extent, 5>>.

What do you guys think? Could this be considered an improvement?

Hewill