|
21034 | 21034 |
|
21035 | 21035 | \indexheader{mdspan}%
|
21036 | 21036 | \begin{codeblock}
|
21037 |
| -// all freestanding |
| 21037 | +// mostly freestanding |
21038 | 21038 | namespace std {
|
21039 | 21039 | // \ref{mdspan.extents}, class template \tcode{extents}
|
21040 | 21040 | template<class IndexType, size_t... Extents>
|
|
21068 | 21068 | // \ref{mdspan.mdspan}, class template \tcode{mdspan}
|
21069 | 21069 | template<class ElementType, class Extents, class LayoutPolicy = layout_right,
|
21070 | 21070 | class AccessorPolicy = default_accessor<ElementType>>
|
21071 |
| - class mdspan; |
| 21071 | + class mdspan; // partially freestanding |
21072 | 21072 |
|
21073 | 21073 | // \ref{mdspan.sub}, \tcode{submdspan} creation
|
21074 | 21074 | template<class OffsetType, class LengthType, class StrideType>
|
|
24691 | 24691 | template<class OtherIndexType>
|
24692 | 24692 | constexpr reference operator[](const array<OtherIndexType, rank()>& indices) const;
|
24693 | 24693 |
|
| 24694 | + template<class... OtherIndexTypes> |
| 24695 | + constexpr reference at(OtherIndexTypes... indices) const; // freestanding-deleted |
| 24696 | + template<class OtherIndexType> |
| 24697 | + constexpr reference at(span<OtherIndexType, rank()> indices) const; // freestanding-deleted |
| 24698 | + template<class OtherIndexType> |
| 24699 | + constexpr reference at(const array<OtherIndexType, rank()>& indices) const; // freestanding-deleted |
| 24700 | + |
24694 | 24701 | constexpr size_type size() const noexcept;
|
24695 | 24702 | constexpr bool empty() const noexcept;
|
24696 | 24703 |
|
|
25139 | 25146 | \end{codeblock}
|
25140 | 25147 | \end{itemdescr}
|
25141 | 25148 |
|
| 25149 | +\indexlibrarymember{at}{mdspan}% |
| 25150 | +\begin{itemdecl} |
| 25151 | +template<class... OtherIndexTypes> |
| 25152 | + constexpr reference at(OtherIndexTypes... indices) const; |
| 25153 | +\end{itemdecl} |
| 25154 | + |
| 25155 | +\begin{itemdescr} |
| 25156 | +\pnum |
| 25157 | +\constraints |
| 25158 | +\begin{itemize} |
| 25159 | +\item |
| 25160 | +\tcode{(is_convertible_v<OtherIndexTypes, index_type> \&\& ...)} is \tcode{true}, |
| 25161 | +\item |
| 25162 | +\tcode{(is_nothrow_constructible_v<index_type, OtherIndexTypes> \&\& ...)} is \tcode{true}, and |
| 25163 | +\item |
| 25164 | +\tcode{sizeof...(OtherIndexTypes) == rank()} is \tcode{true}. |
| 25165 | +\end{itemize} |
| 25166 | + |
| 25167 | +\pnum |
| 25168 | +Let \tcode{I} be \tcode{extents_type::\exposid{index-cast}(std::move(indices))}. |
| 25169 | + |
| 25170 | +\pnum |
| 25171 | +\returns |
| 25172 | +\tcode{(*this)[I...]}. |
| 25173 | + |
| 25174 | +\pnum |
| 25175 | +\throws |
| 25176 | +\tcode{out_of_range} if \tcode{I} is not a multidimensional index in \tcode{extents()}. |
| 25177 | +\end{itemdescr} |
| 25178 | + |
| 25179 | +\indexlibrarymember{at}{mdspan}% |
| 25180 | +\begin{itemdecl} |
| 25181 | +template<class OtherIndexType> |
| 25182 | + constexpr reference at(span<OtherIndexType, rank()> indices) const; |
| 25183 | +template<class OtherIndexType> |
| 25184 | + constexpr reference at(const array<OtherIndexType, rank()>& indices) const; |
| 25185 | +\end{itemdecl} |
| 25186 | + |
| 25187 | +\begin{itemdescr} |
| 25188 | +\pnum |
| 25189 | +\constraints |
| 25190 | +\begin{itemize} |
| 25191 | +\item |
| 25192 | +\tcode{is_convertible_v<const OtherIndexType\&, index_type>} is \tcode{true}, and |
| 25193 | +\item |
| 25194 | +\tcode{is_nothrow_constructible_v<index_type, const OtherIndexType\&>} is \tcode{true}. |
| 25195 | +\end{itemize} |
| 25196 | + |
| 25197 | +\pnum |
| 25198 | +\effects |
| 25199 | +Let \tcode{P} be a parameter pack such that |
| 25200 | +\begin{codeblock} |
| 25201 | +is_same_v<make_index_sequence<rank()>, index_sequence<P...>> |
| 25202 | +\end{codeblock} |
| 25203 | +is \tcode{true}. |
| 25204 | +Equivalent to: |
| 25205 | +\begin{codeblock} |
| 25206 | +return at(extents_type::@\exposid{index-cast}@(as_const(indices[P]))...); |
| 25207 | +\end{codeblock} |
| 25208 | +\end{itemdescr} |
| 25209 | + |
25142 | 25210 | \indexlibrarymember{size}{mdspan}%
|
25143 | 25211 | \begin{itemdecl}
|
25144 | 25212 | constexpr size_type size() const noexcept;
|
|
0 commit comments