tmp/tmp39m4ziy_/{from.md → to.md}
RENAMED
|
@@ -9,13 +9,13 @@ user-defined.
|
|
| 9 |
namespace std {
|
| 10 |
template<class Extents>
|
| 11 |
class layout_stride::mapping {
|
| 12 |
public:
|
| 13 |
using extents_type = Extents;
|
| 14 |
-
using index_type =
|
| 15 |
-
using size_type =
|
| 16 |
-
using rank_type =
|
| 17 |
using layout_type = layout_stride;
|
| 18 |
|
| 19 |
private:
|
| 20 |
static constexpr rank_type rank_ = extents_type::rank(); // exposition only
|
| 21 |
|
|
@@ -56,10 +56,21 @@ namespace std {
|
|
| 56 |
friend constexpr bool operator==(const mapping&, const OtherMapping&) noexcept;
|
| 57 |
|
| 58 |
private:
|
| 59 |
extents_type extents_{}; // exposition only
|
| 60 |
array<index_type, rank_> strides_{}; // exposition only
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
};
|
| 62 |
}
|
| 63 |
```
|
| 64 |
|
| 65 |
If `Extents` is not a specialization of `extents`, then the program is
|
|
@@ -78,11 +89,15 @@ Let `REQUIRED-SPAN-SIZE(e, strides)` be:
|
|
| 78 |
|
| 79 |
- `1`, if `e.rank() == 0` is `true`,
|
| 80 |
- otherwise `0`, if the size of the multidimensional index space `e` is
|
| 81 |
0,
|
| 82 |
- otherwise `1` plus the sum of products of `(e.extent(r) - 1)` and
|
| 83 |
-
`
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
Let `OFFSET(m)` be:
|
| 86 |
|
| 87 |
- `m()`, if `e.rank() == 0` is `true`,
|
| 88 |
- otherwise `0`, if the size of the multidimensional index space `e` is
|
|
@@ -150,11 +165,12 @@ template<class OtherIndexType>
|
|
| 150 |
- `is_nothrow_constructible_v<index_type, const OtherIndexType&>` is
|
| 151 |
`true`.
|
| 152 |
|
| 153 |
*Preconditions:*
|
| 154 |
|
| 155 |
-
- `s[`i`]
|
|
|
|
| 156 |
- *`REQUIRED-SPAN-SIZE`*`(e, s)` is representable as a value of type
|
| 157 |
`index_type` [[basic.fundamental]].
|
| 158 |
- If *rank\_* is greater than 0, then there exists a permutation P of
|
| 159 |
the integers in the range [0, rank_), such that
|
| 160 |
`s[`pᵢ`] >= s[`pᵢ₋₁`] * e.extent(p`ᵢ₋₁`)` is `true` for all i in the
|
|
@@ -182,11 +198,11 @@ template<class StridedLayoutMapping>
|
|
| 182 |
- `StridedLayoutMapping::is_always_strided()` is `true`.
|
| 183 |
|
| 184 |
*Preconditions:*
|
| 185 |
|
| 186 |
- `StridedLayoutMapping` meets the layout mapping
|
| 187 |
-
requirements [[mdspan.layout.
|
| 188 |
- `other.stride(`r`) > 0` is `true` for every rank index r of
|
| 189 |
`extents()`,
|
| 190 |
- `other.required_span_size()` is representable as a value of type
|
| 191 |
`index_type` [[basic.fundamental]], and
|
| 192 |
- *`OFFSET`*`(other) == 0` is `true`.
|
|
@@ -198,13 +214,15 @@ direct-non-list-initializes *`strides_`*`[`d`]` with
|
|
| 198 |
|
| 199 |
Remarks: The expression inside `explicit` is equivalent to:
|
| 200 |
|
| 201 |
``` cpp
|
| 202 |
!(is_convertible_v<typename StridedLayoutMapping::extents_type, extents_type> &&
|
| 203 |
-
(is-mapping-of<layout_left,
|
| 204 |
-
is-mapping-of<layout_right,
|
| 205 |
-
is-mapping-of<
|
|
|
|
|
|
|
| 206 |
```
|
| 207 |
|
| 208 |
###### Observers <a id="mdspan.layout.stride.obs">[[mdspan.layout.stride.obs]]</a>
|
| 209 |
|
| 210 |
``` cpp
|
|
|
|
| 9 |
namespace std {
|
| 10 |
template<class Extents>
|
| 11 |
class layout_stride::mapping {
|
| 12 |
public:
|
| 13 |
using extents_type = Extents;
|
| 14 |
+
using index_type = extents_type::index_type;
|
| 15 |
+
using size_type = extents_type::size_type;
|
| 16 |
+
using rank_type = extents_type::rank_type;
|
| 17 |
using layout_type = layout_stride;
|
| 18 |
|
| 19 |
private:
|
| 20 |
static constexpr rank_type rank_ = extents_type::rank(); // exposition only
|
| 21 |
|
|
|
|
| 56 |
friend constexpr bool operator==(const mapping&, const OtherMapping&) noexcept;
|
| 57 |
|
| 58 |
private:
|
| 59 |
extents_type extents_{}; // exposition only
|
| 60 |
array<index_type, rank_> strides_{}; // exposition only
|
| 61 |
+
|
| 62 |
+
// [mdspan.sub.map], submdspan mapping specialization
|
| 63 |
+
template<class... SliceSpecifiers>
|
| 64 |
+
constexpr auto submdspan-mapping-impl(SliceSpecifiers...) const // exposition only
|
| 65 |
+
-> see below;
|
| 66 |
+
|
| 67 |
+
template<class... SliceSpecifiers>
|
| 68 |
+
friend constexpr auto submdspan_mapping(
|
| 69 |
+
const mapping& src, SliceSpecifiers... slices) {
|
| 70 |
+
return src.submdspan-mapping-impl(slices...);
|
| 71 |
+
}
|
| 72 |
};
|
| 73 |
}
|
| 74 |
```
|
| 75 |
|
| 76 |
If `Extents` is not a specialization of `extents`, then the program is
|
|
|
|
| 89 |
|
| 90 |
- `1`, if `e.rank() == 0` is `true`,
|
| 91 |
- otherwise `0`, if the size of the multidimensional index space `e` is
|
| 92 |
0,
|
| 93 |
- otherwise `1` plus the sum of products of `(e.extent(r) - 1)` and
|
| 94 |
+
``` cpp
|
| 95 |
+
extents_type::index-cast(strides[r])
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
for all r in the range [0, `e.rank()`).
|
| 99 |
|
| 100 |
Let `OFFSET(m)` be:
|
| 101 |
|
| 102 |
- `m()`, if `e.rank() == 0` is `true`,
|
| 103 |
- otherwise `0`, if the size of the multidimensional index space `e` is
|
|
|
|
| 165 |
- `is_nothrow_constructible_v<index_type, const OtherIndexType&>` is
|
| 166 |
`true`.
|
| 167 |
|
| 168 |
*Preconditions:*
|
| 169 |
|
| 170 |
+
- The result of converting `s[`i`]` to `index_type` is greater than `0`
|
| 171 |
+
for all i in the range [0, rank_).
|
| 172 |
- *`REQUIRED-SPAN-SIZE`*`(e, s)` is representable as a value of type
|
| 173 |
`index_type` [[basic.fundamental]].
|
| 174 |
- If *rank\_* is greater than 0, then there exists a permutation P of
|
| 175 |
the integers in the range [0, rank_), such that
|
| 176 |
`s[`pᵢ`] >= s[`pᵢ₋₁`] * e.extent(p`ᵢ₋₁`)` is `true` for all i in the
|
|
|
|
| 198 |
- `StridedLayoutMapping::is_always_strided()` is `true`.
|
| 199 |
|
| 200 |
*Preconditions:*
|
| 201 |
|
| 202 |
- `StridedLayoutMapping` meets the layout mapping
|
| 203 |
+
requirements [[mdspan.layout.reqmts]],
|
| 204 |
- `other.stride(`r`) > 0` is `true` for every rank index r of
|
| 205 |
`extents()`,
|
| 206 |
- `other.required_span_size()` is representable as a value of type
|
| 207 |
`index_type` [[basic.fundamental]], and
|
| 208 |
- *`OFFSET`*`(other) == 0` is `true`.
|
|
|
|
| 214 |
|
| 215 |
Remarks: The expression inside `explicit` is equivalent to:
|
| 216 |
|
| 217 |
``` cpp
|
| 218 |
!(is_convertible_v<typename StridedLayoutMapping::extents_type, extents_type> &&
|
| 219 |
+
(is-mapping-of<layout_left, StridedLayoutMapping> ||
|
| 220 |
+
is-mapping-of<layout_right, StridedLayoutMapping> ||
|
| 221 |
+
is-layout-left-padded-mapping-of<StridedLayoutMapping> ||
|
| 222 |
+
is-layout-right-padded-mapping-of<StridedLayoutMapping> ||
|
| 223 |
+
is-mapping-of<layout_stride, StridedLayoutMapping>))
|
| 224 |
```
|
| 225 |
|
| 226 |
###### Observers <a id="mdspan.layout.stride.obs">[[mdspan.layout.stride.obs]]</a>
|
| 227 |
|
| 228 |
``` cpp
|