From Jason Turner

[mdspan.layout.left]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpascidp4e/{from.md → to.md} +54 -5
tmp/tmpascidp4e/{from.md → to.md} RENAMED
@@ -9,13 +9,13 @@ stride 1, and strides increase left-to-right as the product of extents.
9
  namespace std {
10
  template<class Extents>
11
  class layout_left::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_left;
18
 
19
  // [mdspan.layout.left.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_right::mapping<OtherExtents>&) noexcept;
 
 
 
 
29
  template<class OtherExtents>
30
  constexpr explicit(extents_type::rank() > 0)
31
  mapping(const layout_stride::mapping<OtherExtents>&);
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
@@ -94,11 +109,11 @@ value of type `index_type` [[basic.fundamental]].
94
 
95
  *Effects:* Direct-non-list-initializes *extents\_* with
96
  `other.extents()`.
97
 
98
  ``` cpp
99
- template<class OtherExents>
100
  constexpr explicit(!is_convertible_v<OtherExtents, extents_type>)
101
  mapping(const layout_right::mapping<OtherExtents>& other) noexcept;
102
  ```
103
 
104
  *Constraints:*
@@ -110,10 +125,44 @@ template<class OtherExents>
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);
119
  ```
@@ -165,11 +214,11 @@ is `true`. Equivalent to:
165
  ``` cpp
166
  return ((static_cast<index_type>(i) * stride(P)) + ... + 0);
167
  ```
168
 
169
  ``` cpp
170
- constexpr index_type stride(rank_type i) const;
171
  ```
172
 
173
  *Constraints:* `extents_type::rank() > 0` is `true`.
174
 
175
  *Preconditions:* `i < extents_type::rank()` is `true`.
 
9
  namespace std {
10
  template<class Extents>
11
  class layout_left::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_left;
18
 
19
  // [mdspan.layout.left.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_right::mapping<OtherExtents>&) noexcept;
29
+ template<class LayoutLeftPaddedMapping>
30
+ constexpr explicit(!is_convertible_v<typename LayoutLeftPaddedMapping::extents_type,
31
+ extents_type>)
32
+ mapping(const LayoutLeftPaddedMapping&) noexcept;
33
  template<class OtherExtents>
34
  constexpr explicit(extents_type::rank() > 0)
35
  mapping(const layout_stride::mapping<OtherExtents>&);
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
 
109
 
110
  *Effects:* Direct-non-list-initializes *extents\_* with
111
  `other.extents()`.
112
 
113
  ``` cpp
114
+ template<class OtherExtents>
115
  constexpr explicit(!is_convertible_v<OtherExtents, extents_type>)
116
  mapping(const layout_right::mapping<OtherExtents>& other) noexcept;
117
  ```
118
 
119
  *Constraints:*
 
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 LayoutLeftPaddedMapping>
132
+ constexpr explicit(!is_convertible_v<typename LayoutLeftPaddedMapping::extents_type,
133
+ extents_type>)
134
+ mapping(const LayoutLeftPaddedMapping&) noexcept;
135
+ ```
136
+
137
+ *Constraints:*
138
+
139
+ - *`is-layout-left-padded-mapping-of`*`<LayoutLeftPaddedMapping>` is
140
+ `true`.
141
+ - `is_constructible_v<extents_type, typename LayoutLeftPaddedMapping::extents_type>`
142
+ is `true`.
143
+
144
+ *Mandates:* If
145
+
146
+ - `Extents::rank()` is greater than one,
147
+ - `Extents::static_extent(0)` does not equal `dynamic_extent`, and
148
+ - `LayoutLeftPaddedMapping::`*`static-padding-stride`* does not equal
149
+ `dynamic_extent`,
150
+
151
+ then `Extents::static_extent(0)` equals
152
+ `LayoutLeftPaddedMapping::`*`static-padding-stride`*.
153
+
154
+ *Preconditions:*
155
+
156
+ - If `extents_type::rank() > 1` is `true`, then `other.stride(1)` equals
157
+ `other.extents().extent(0)`.
158
+ - `other.required_span_size()` is representable as a value of type
159
+ `index_type`.
160
+
161
+ *Effects:* Direct-non-list-initializes `extents_` with
162
+ `other.extents()`.
163
+
164
  ``` cpp
165
  template<class OtherExtents>
166
  constexpr explicit(extents_type::rank() > 0)
167
  mapping(const layout_stride::mapping<OtherExtents>& other);
168
  ```
 
214
  ``` cpp
215
  return ((static_cast<index_type>(i) * stride(P)) + ... + 0);
216
  ```
217
 
218
  ``` cpp
219
+ constexpr index_type stride(rank_type i) const noexcept;
220
  ```
221
 
222
  *Constraints:* `extents_type::rank() > 0` is `true`.
223
 
224
  *Preconditions:* `i < extents_type::rank()` is `true`.