From Jason Turner

[mdspan.layout.right]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpy30lajmv/{from.md → to.md} +55 -4
tmp/tmpy30lajmv/{from.md → to.md} RENAMED
@@ -9,13 +9,13 @@ stride 1, and strides increase right-to-left as the product of extents.
9
  namespace std {
10
  template<class Extents>
11
  class layout_right::mapping {
12
  public:
13
  using extents_type = Extents;
14
- using index_type = typename extents_type::index_type;
15
- using size_type = typename extents_type::size_type;
16
- using rank_type = typename extents_type::rank_type;
17
  using layout_type = layout_right;
18
 
19
  // [mdspan.layout.right.cons], constructors
20
  constexpr mapping() noexcept = default;
21
  constexpr mapping(const mapping&) noexcept = default;
@@ -24,10 +24,14 @@ namespace std {
24
  constexpr explicit(!is_convertible_v<OtherExtents, extents_type>)
25
  mapping(const mapping<OtherExtents>&) noexcept;
26
  template<class OtherExtents>
27
  constexpr explicit(!is_convertible_v<OtherExtents, extents_type>)
28
  mapping(const layout_left::mapping<OtherExtents>&) noexcept;
 
 
 
 
29
  template<class OtherExtents>
30
  constexpr explicit(extents_type::rank() > 0)
31
  mapping(const layout_stride::mapping<OtherExtents>&) noexcept;
32
 
33
  constexpr mapping& operator=(const mapping&) noexcept = default;
@@ -53,10 +57,21 @@ namespace std {
53
  template<class OtherExtents>
54
  friend constexpr bool operator==(const mapping&, const mapping<OtherExtents>&) noexcept;
55
 
56
  private:
57
  extents_type extents_{}; // exposition only
 
 
 
 
 
 
 
 
 
 
 
58
  };
59
  }
60
  ```
61
 
62
  If `Extents` is not a specialization of `extents`, then the program is
@@ -110,10 +125,46 @@ template<class OtherExtents>
110
  value of type `index_type` [[basic.fundamental]].
111
 
112
  *Effects:* Direct-non-list-initializes *extents\_* with
113
  `other.extents()`.
114
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  ``` cpp
116
  template<class OtherExtents>
117
  constexpr explicit(extents_type::rank() > 0)
118
  mapping(const layout_stride::mapping<OtherExtents>& other) noexcept;
119
  ```
@@ -133,11 +184,11 @@ template<class OtherExtents>
133
  `other.extents()`.
134
 
135
  ###### Observers <a id="mdspan.layout.right.obs">[[mdspan.layout.right.obs]]</a>
136
 
137
  ``` cpp
138
- index_type required_span_size() const noexcept;
139
  ```
140
 
141
  *Returns:* `extents().`*`fwd-prod-of-extents`*`(extents_type::rank())`.
142
 
143
  ``` cpp
 
9
  namespace std {
10
  template<class Extents>
11
  class layout_right::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_right;
18
 
19
  // [mdspan.layout.right.cons], constructors
20
  constexpr mapping() noexcept = default;
21
  constexpr mapping(const mapping&) noexcept = default;
 
24
  constexpr explicit(!is_convertible_v<OtherExtents, extents_type>)
25
  mapping(const mapping<OtherExtents>&) noexcept;
26
  template<class OtherExtents>
27
  constexpr explicit(!is_convertible_v<OtherExtents, extents_type>)
28
  mapping(const layout_left::mapping<OtherExtents>&) noexcept;
29
+ template<class LayoutRightPaddedMapping>
30
+ constexpr explicit(!is_convertible_v<typename LayoutRightPaddedMapping::extents_type,
31
+ extents_type>)
32
+ mapping(const LayoutRightPaddedMapping&) noexcept;
33
  template<class OtherExtents>
34
  constexpr explicit(extents_type::rank() > 0)
35
  mapping(const layout_stride::mapping<OtherExtents>&) noexcept;
36
 
37
  constexpr mapping& operator=(const mapping&) noexcept = default;
 
57
  template<class OtherExtents>
58
  friend constexpr bool operator==(const mapping&, const mapping<OtherExtents>&) noexcept;
59
 
60
  private:
61
  extents_type extents_{}; // exposition only
62
+
63
+ // [mdspan.sub.map], submdspan mapping specialization
64
+ template<class... SliceSpecifiers>
65
+ constexpr auto submdspan-mapping-impl(SliceSpecifiers...) const // exposition only
66
+ -> see below;
67
+
68
+ template<class... SliceSpecifiers>
69
+ friend constexpr auto submdspan_mapping(
70
+ const mapping& src, SliceSpecifiers... slices) {
71
+ return src.submdspan-mapping-impl(slices...);
72
+ }
73
  };
74
  }
75
  ```
76
 
77
  If `Extents` is not a specialization of `extents`, then the program is
 
125
  value of type `index_type` [[basic.fundamental]].
126
 
127
  *Effects:* Direct-non-list-initializes *extents\_* with
128
  `other.extents()`.
129
 
130
+ ``` cpp
131
+ template<class LayoutRightPaddedMapping>
132
+ constexpr explicit(!is_convertible_v<typename LayoutRightPaddedMapping::extents_type,
133
+ extents_type>)
134
+ mapping(const LayoutRightPaddedMapping&) noexcept;
135
+ ```
136
+
137
+ *Constraints:*
138
+
139
+ - *`is-layout-right-padded-mapping-of`*`<LayoutRightPaddedMapping>` is
140
+ `true`.
141
+ - `is_constructible_v<extents_type, typename LayoutRightPaddedMapping::extents_- type>`
142
+ is `true`.
143
+
144
+ *Mandates:* If
145
+
146
+ - `Extents::rank()` is greater than one,
147
+ - `Extents::static_extent(Extents::rank() - 1)` does not equal
148
+ `dynamic_extent`, and
149
+ - `LayoutRightPaddedMapping::`*`static-padding-stride`* does not equal
150
+ `dynamic_extent`,
151
+
152
+ then `Extents::static_extent(Extents::rank() - 1)` equals
153
+ `LayoutRightPaddedMapping::`*`static-padding-stride`*.
154
+
155
+ *Preconditions:*
156
+
157
+ - If `extents_type::rank() > 1` is `true`, then
158
+ `other.stride(extents_type::rank() - 2)` equals
159
+ `other.extents().extent(extents_type::rank() - 1)`.
160
+ - `other.required_span_size()` is representable as a value of type
161
+ `index_type`.
162
+
163
+ *Effects:* Direct-non-list-initializes `extents_` with
164
+ `other.extents()`.
165
+
166
  ``` cpp
167
  template<class OtherExtents>
168
  constexpr explicit(extents_type::rank() > 0)
169
  mapping(const layout_stride::mapping<OtherExtents>& other) noexcept;
170
  ```
 
184
  `other.extents()`.
185
 
186
  ###### Observers <a id="mdspan.layout.right.obs">[[mdspan.layout.right.obs]]</a>
187
 
188
  ``` cpp
189
+ constexpr index_type required_span_size() const noexcept;
190
  ```
191
 
192
  *Returns:* `extents().`*`fwd-prod-of-extents`*`(extents_type::rank())`.
193
 
194
  ``` cpp