Would be better that instead of type alias use template variable?

Then code will look more clean:

```

//paper version:

mdspan ms(p, integral_c<3>{}, 42, integral_c<5>{});

//bit streamlined version:

template<auto I>

std::integral_constant<decltype(I), I> integral_c = {};

mdspan ms(p, integral_c<3>, 42, integral_c<5>);

```

That's a very good point! it omits annoying brackets IMO.

probably name could be even shortened like:

```

std::mdspan ms(p, std::c<3>, 42, std::c<5>);

```

My initial idea was to name it `std::constant`, but this seems to imply that such NTTP can be non-integral such as `pair<int, int>`.

Although this is completely feasible, it seems to deviate from the original intention of the paper.

I think just calling it `std::c` seems too shorthand, but I'm still open for better naming.

Not too sure about the status of P2781 `std::constexpr_t`, maybe this can be left entirely to it.

Thanks agian for the valuable advice.

Hewill

Marcin Jaczewski <marcinjaczewski86@gmail.com> 於 2023年10月18日 週三 上午4:41寫道：

wt., 17 paź 2023 o 05:41 Hewill Kang via Std-Proposals

<std-proposals@lists.isocpp.org> napisał(a):

>

> 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

Would be better that instead of type alias use template variable?

Then code will look more clean:

```

//paper version:

mdspan ms(p, integral_c<3>{}, 42, integral_c<5>{});

//bit streamlined version:

template<auto I>

std::integral_constant<decltype(I), I> integral_c = {};

mdspan ms(p, integral_c<3>, 42, integral_c<5>);

```

probably name could be even shortened like:

```

std::mdspan ms(p, std::c<3>, 42, std::c<5>);

```

another option is user defined literals but there

is problem for good suffix as many are already

used or could conflict with hex numbers (like suffix `c`).

>

> --

> Std-Proposals mailing list

> Std-Proposals@lists.isocpp.org

> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals