|
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>
|
|
24698 | 24698 | template<class OtherIndexType>
|
24699 | 24699 | constexpr reference operator[](const array<OtherIndexType, rank()>& indices) const;
|
24700 | 24700 |
|
| 24701 | + template<class... OtherIndexTypes> |
| 24702 | + constexpr reference |
| 24703 | + at(OtherIndexTypes... indices) const; // freestanding-deleted |
| 24704 | + template<class OtherIndexType> |
| 24705 | + constexpr reference |
| 24706 | + at(span<OtherIndexType, rank()> indices) const; // freestanding-deleted |
| 24707 | + template<class OtherIndexType> |
| 24708 | + constexpr reference |
| 24709 | + at(const array<OtherIndexType, rank()>& indices) const; // freestanding-deleted |
| 24710 | + |
24701 | 24711 | constexpr size_type size() const noexcept;
|
24702 | 24712 | constexpr bool empty() const noexcept;
|
24703 | 24713 |
|
|
25146 | 25156 | \end{codeblock}
|
25147 | 25157 | \end{itemdescr}
|
25148 | 25158 |
|
| 25159 | +\indexlibrarymember{at}{mdspan}% |
| 25160 | +\begin{itemdecl} |
| 25161 | +template<class... OtherIndexTypes> |
| 25162 | + constexpr reference at(OtherIndexTypes... indices) const; |
| 25163 | +\end{itemdecl} |
| 25164 | + |
| 25165 | +\begin{itemdescr} |
| 25166 | +\pnum |
| 25167 | +\constraints |
| 25168 | +\begin{itemize} |
| 25169 | +\item |
| 25170 | +\tcode{(is_convertible_v<OtherIndexTypes, index_type> \&\& ...)} is \tcode{true}, |
| 25171 | +\item |
| 25172 | +\tcode{(is_nothrow_constructible_v<index_type, OtherIndexTypes> \&\& ...)} is \tcode{true}, and |
| 25173 | +\item |
| 25174 | +\tcode{sizeof...(OtherIndexTypes) == rank()} is \tcode{true}. |
| 25175 | +\end{itemize} |
| 25176 | + |
| 25177 | +\pnum |
| 25178 | +Let \tcode{I} be \tcode{extents_type::\exposid{index-cast}(std::move(indices))}. |
| 25179 | + |
| 25180 | +\pnum |
| 25181 | +\returns |
| 25182 | +\tcode{(*this)[I...]}. |
| 25183 | + |
| 25184 | +\pnum |
| 25185 | +\throws |
| 25186 | +\tcode{out_of_range} if \tcode{I} is not a multidimensional index in \tcode{extents()}. |
| 25187 | +\end{itemdescr} |
| 25188 | + |
| 25189 | +\indexlibrarymember{at}{mdspan}% |
| 25190 | +\begin{itemdecl} |
| 25191 | +template<class OtherIndexType> |
| 25192 | + constexpr reference at(span<OtherIndexType, rank()> indices) const; |
| 25193 | +template<class OtherIndexType> |
| 25194 | + constexpr reference at(const array<OtherIndexType, rank()>& indices) const; |
| 25195 | +\end{itemdecl} |
| 25196 | + |
| 25197 | +\begin{itemdescr} |
| 25198 | +\pnum |
| 25199 | +\constraints |
| 25200 | +\begin{itemize} |
| 25201 | +\item |
| 25202 | +\tcode{is_convertible_v<const OtherIndexType\&, index_type>} is \tcode{true}, and |
| 25203 | +\item |
| 25204 | +\tcode{is_nothrow_constructible_v<index_type, const OtherIndexType\&>} is \tcode{true}. |
| 25205 | +\end{itemize} |
| 25206 | + |
| 25207 | +\pnum |
| 25208 | +\effects |
| 25209 | +Let \tcode{P} be a parameter pack such that |
| 25210 | +\begin{codeblock} |
| 25211 | +is_same_v<make_index_sequence<rank()>, index_sequence<P...>> |
| 25212 | +\end{codeblock} |
| 25213 | +is \tcode{true}. |
| 25214 | +Equivalent to: |
| 25215 | +\begin{codeblock} |
| 25216 | +return at(extents_type::@\exposid{index-cast}@(as_const(indices[P]))...); |
| 25217 | +\end{codeblock} |
| 25218 | +\end{itemdescr} |
| 25219 | + |
25149 | 25220 | \indexlibrarymember{size}{mdspan}%
|
25150 | 25221 | \begin{itemdecl}
|
25151 | 25222 | constexpr size_type size() const noexcept;
|
|
0 commit comments