[libcxx-commits] [libcxx] [libc++] P3029R1: Better `mdspan`'s CTAD - `std::extents` (PR #89015)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Tue Apr 16 23:22:04 PDT 2024


================
@@ -455,8 +455,15 @@ template <class _IndexType, size_t _Rank>
 using dextents = typename __mdspan_detail::__make_dextents<_IndexType, _Rank>::type;
 
 // Deduction guide for extents
+#  if _LIBCPP_STD_VER >= 26
 template <class... _IndexTypes>
-extents(_IndexTypes...) -> extents<size_t, size_t(((void)sizeof(_IndexTypes), dynamic_extent))...>;
+  requires(is_convertible_v<_IndexTypes, size_t> && ...)
----------------
frederick-vs-ja wrote:

Uh, this line isn't really changed by P3029R1.

Would it be better to make only `__maybe_static_ext<_IndexTypes>...` and `size_t(((void)sizeof(_IndexTypes), dynamic_extent))...` (or the deduced `extents<...>`) guarded by `#if`? @mordante 

https://github.com/llvm/llvm-project/pull/89015


More information about the libcxx-commits mailing list