tmp/tmpztw8o21y/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
##### Exposition-only helpers <a id="mdspan.sub.helpers">[[mdspan.sub.helpers]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
template<class T>
|
| 5 |
+
constexpr T de-ice(T val) { return val; }
|
| 6 |
+
template<integral-constant-like T>
|
| 7 |
+
constexpr auto de-ice(T) { return T::value; }
|
| 8 |
+
|
| 9 |
+
template<class IndexType, size_t k, class... SliceSpecifiers>
|
| 10 |
+
constexpr IndexType first_(SliceSpecifiers... slices);
|
| 11 |
+
```
|
| 12 |
+
|
| 13 |
+
*Mandates:* `IndexType` is a signed or unsigned integer type.
|
| 14 |
+
|
| 15 |
+
Let φₖ denote the following value:
|
| 16 |
+
|
| 17 |
+
- sₖ if Sₖ models `convertible_to<IndexType>`;
|
| 18 |
+
- otherwise, `get<0>(`sₖ`)` if Sₖ models `index-pair-like<IndexType>`;
|
| 19 |
+
- otherwise, *`de-ice`*`(`sₖ`.offset)` if Sₖ is a specialization of
|
| 20 |
+
`strided_slice`;
|
| 21 |
+
- otherwise, `0`.
|
| 22 |
+
|
| 23 |
+
*Preconditions:* φₖ is representable as a value of type `IndexType`.
|
| 24 |
+
|
| 25 |
+
*Returns:* `extents<IndexType>::`*`index-cast`*`(`φₖ`)`.
|
| 26 |
+
|
| 27 |
+
``` cpp
|
| 28 |
+
template<size_t k, class Extents, class... SliceSpecifiers>
|
| 29 |
+
constexpr auto last_(const Extents& src, SliceSpecifiers... slices);
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
*Mandates:* `Extents` is a specialization of `extents`.
|
| 33 |
+
|
| 34 |
+
Let `index_type` be `typename Extents::index_type`.
|
| 35 |
+
|
| 36 |
+
Let λₖ denote the following value:
|
| 37 |
+
|
| 38 |
+
- *`de-ice`*`(`sₖ`) + 1` if Sₖ models `convertible_to<index_type>`;
|
| 39 |
+
otherwise
|
| 40 |
+
- `get<1>(`sₖ`)` if Sₖ models `index-pair-like<index_type>`; otherwise
|
| 41 |
+
- *`de-ice`*`(`sₖ`.offset)` `+` *`de-ice`*`(`sₖ`.extent)` if Sₖ is a
|
| 42 |
+
specialization of `strided_slice`; otherwise
|
| 43 |
+
- `src.extent(k)`.
|
| 44 |
+
|
| 45 |
+
*Preconditions:* λₖ is representable as a value of type `index_type`.
|
| 46 |
+
|
| 47 |
+
*Returns:* `Extents::`*`index-cast`*`(`λₖ`)`.
|
| 48 |
+
|
| 49 |
+
``` cpp
|
| 50 |
+
template<class IndexType, size_t N, class... SliceSpecifiers>
|
| 51 |
+
constexpr array<IndexType, sizeof...(SliceSpecifiers)>
|
| 52 |
+
src-indices(const array<IndexType, N>& indices, SliceSpecifiers... slices);
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
*Mandates:* `IndexType` is a signed or unsigned integer type.
|
| 56 |
+
|
| 57 |
+
*Returns:* An `array<IndexType, sizeof...(SliceSpecifiers)> src_idx`
|
| 58 |
+
such that for each k in the range \[`0`, `sizeof...(SliceSpecifiers)`),
|
| 59 |
+
`src_idx[`k`]` equals
|
| 60 |
+
|
| 61 |
+
- *`first_`*`<IndexType, `k`>(slices...)` for each k where
|
| 62 |
+
*`map-rank`*`[`k`]` equals `dynamic_extent`,
|
| 63 |
+
- otherwise, *`first_`*`<IndexType, `k`>(slices...)` `+`
|
| 64 |
+
`indices[`*`map-rank`*`[`k`]]`.
|
| 65 |
+
|