Skip to content

Commit

Permalink
P3029R1 Better mdspan's CTAD
Browse files Browse the repository at this point in the history
  • Loading branch information
burblebee authored and tkoeppe committed Apr 16, 2024
1 parent 063acd3 commit 608090e
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions source/containers.tex
Expand Up @@ -18228,6 +18228,20 @@
// constants
inline constexpr size_t @\libglobal{dynamic_extent}@ = numeric_limits<size_t>::max();

template<class T>
concept @\defexposconcept{integral-constant-like}@ = // \expos
is_integral_v<decltype(T::value)> &&
!is_same_v<bool, remove_const_t<decltype(T::value)>> &&
@\libconcept{convertible_to}@<T, decltype(T::value)> &&
@\libconcept{equality_comparable_with}@<T, decltype(T::value)> &&
bool_constant<T() == T::value>::value &&
bool_constant<static_cast<decltype(T::value)>(T()) == T::value>::value;

template<class T>
constexpr size_t @\defexposconcept{maybe-static-ext}@ = dynamic_extent; // \expos
template<@\exposconcept{integral-constant-like}@ T>
constexpr size_t @\exposconcept{maybe-static-ext}@<T> = {T::value};

// \ref{views.span}, class template \tcode{span}
template<class ElementType, size_t Extent = dynamic_extent>
class span; // partially freestanding
Expand Down Expand Up @@ -18343,7 +18357,8 @@
};

template<class It, class EndOrSize>
span(It, EndOrSize) -> span<remove_reference_t<iter_reference_t<It>>>;
span(It, EndOrSize) -> span<remove_reference_t<iter_reference_t<It>>,
@\exposconcept{maybe-static-ext}@<EndOrSize>>;
template<class T, size_t N>
span(T (&)[N]) -> span<T, N>;
template<class T, size_t N>
Expand Down Expand Up @@ -18635,7 +18650,8 @@
\indexlibrary{\idxcode{span}!deduction guide}%
\begin{itemdecl}
template<class It, class EndOrSize>
span(It, EndOrSize) -> span<remove_reference_t<iter_reference_t<It>>>;
span(It, EndOrSize) -> span<remove_reference_t<iter_reference_t<It>>,
@\exposconcept{maybe-static-ext}@<EndOrSize>>;
\end{itemdecl}

\begin{itemdescr}
Expand Down Expand Up @@ -19098,15 +19114,6 @@
const mdspan<ElementType, Extents, LayoutPolicy, AccessorPolicy>& src,
SliceSpecifiers... slices) -> @\seebelow@;

template<class T>
concept @\defexposconcept{integral-constant-like}@ = // \expos
is_integral_v<decltype(T::value)> &&
!is_same_v<bool, remove_const_t<decltype(T::value)>> &&
@\libconcept{convertible_to}@<T, decltype(T::value)> &&
@\libconcept{equality_comparable_with}@<T, decltype(T::value)> &&
bool_constant<T() == T::value>::value &&
bool_constant<static_cast<decltype(T::value)>(T()) == T::value>::value;

template<class T, class IndexType>
concept @\defexposconcept{index-pair-like}@ = // \expos
@\exposconcept{pair-like}@<T> &&
Expand Down Expand Up @@ -19458,7 +19465,7 @@

\pnum
\remarks
The deduced type is \tcode{dextents<size_t, sizeof...(Integrals)>}.
The deduced type is \tcode{extents<size_t, \exposconcept{maybe-static-ext}<Integrals>...>}.
\end{itemdescr}

\rSec4[mdspan.extents.obs]{Observers of the multidimensional index space}
Expand Down Expand Up @@ -22549,7 +22556,7 @@
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)>>;
-> mdspan<ElementType, extents<size_t, @\exposconcept{maybe-static-ext}@<Integrals>...>>;

template<class ElementType, class OtherIndexType, size_t N>
mdspan(ElementType*, span<OtherIndexType, N>)
Expand Down

0 comments on commit 608090e

Please sign in to comment.