From Jason Turner

[mdspan.layout.rightpad.overview]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpeng7wita/{from.md → to.md} +131 -0
tmp/tmpeng7wita/{from.md → to.md} RENAMED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ###### Overview <a id="mdspan.layout.rightpad.overview">[[mdspan.layout.rightpad.overview]]</a>
2
+
3
+ `layout_right_padded` provides a layout mapping that behaves like
4
+ `layout_right::mapping`, except that the padding stride
5
+ `stride(extents_type::rank() - 2)` can be greater than or equal to
6
+ `extents_type::extent(extents_type::rank() - 1)`.
7
+
8
+ ``` cpp
9
+ namespace std {
10
+ template<size_t PaddingValue>
11
+ template<class Extents>
12
+ class layout_right_padded<PaddingValue>::mapping {
13
+ public:
14
+ static constexpr size_t padding_value = PaddingValue;
15
+
16
+ using extents_type = Extents;
17
+ using index_type = extents_type::index_type;
18
+ using size_type = extents_type::size_type;
19
+ using rank_type = extents_type::rank_type;
20
+ using layout_type = layout_right_padded<PaddingValue>;
21
+
22
+ private:
23
+ static constexpr size_t rank_ = extents_type::rank(); // exposition only
24
+ static constexpr size_t last-static-extent = // exposition only
25
+ extents_type::static_extent(rank_ - 1);
26
+
27
+ // [mdspan.layout.rightpad.expo], exposition-only members
28
+ static constexpr size_t static-padding-stride = see below; // exposition only
29
+
30
+ public:
31
+ // [mdspan.layout.rightpad.cons], constructors
32
+ constexpr mapping() noexcept : mapping(extents_type{}) {}
33
+ constexpr mapping(const mapping&) noexcept = default;
34
+ constexpr mapping(const extents_type&);
35
+ template<class OtherIndexType>
36
+ constexpr mapping(const extents_type&, OtherIndexType);
37
+
38
+ template<class OtherExtents>
39
+ constexpr explicit(!is_convertible_v<OtherExtents, extents_type>)
40
+ mapping(const layout_right::mapping<OtherExtents>&);
41
+ template<class OtherExtents>
42
+ constexpr explicit(rank_ > 0)
43
+ mapping(const layout_stride::mapping<OtherExtents>&);
44
+ template<class LayoutRightPaddedMapping>
45
+ constexpr explicit(see below)
46
+ mapping(const LayoutRightPaddedMapping&);
47
+ template<class LayoutLeftPaddedMapping>
48
+ constexpr explicit(see below)
49
+ mapping(const LayoutLeftPaddedMapping&) noexcept;
50
+
51
+ constexpr mapping& operator=(const mapping&) noexcept = default;
52
+
53
+ // [mdspan.layout.rightpad.obs], observers
54
+ constexpr const extents_type& extents() const noexcept { return extents_; }
55
+ constexpr array<index_type, rank_> strides() const noexcept;
56
+
57
+ constexpr index_type required_span_size() const noexcept;
58
+
59
+ template<class... Indices>
60
+ constexpr index_type operator()(Indices...) const noexcept;
61
+
62
+ static constexpr bool is_always_unique() noexcept { return true; }
63
+ static constexpr bool is_always_exhaustive() noexcept;
64
+ static constexpr bool is_always_strided() noexcept { return true; }
65
+
66
+ static constexpr bool is_unique() noexcept { return true; }
67
+ constexpr bool is_exhaustive() const noexcept;
68
+ static constexpr bool is_strided() noexcept { return true; }
69
+
70
+ constexpr index_type stride(rank_type) const noexcept;
71
+
72
+ template<class LayoutRightPaddedMapping>
73
+ friend constexpr bool operator==(const mapping&, const LayoutRightPaddedMapping&) noexcept;
74
+
75
+ private:
76
+ // [mdspan.layout.rightpad.expo], exposition-only members
77
+ index_type stride-rm2 = static-padding-stride; // exposition only
78
+ extents_type extents_{}; // exposition only
79
+
80
+ // [mdspan.sub.map], submdspan mapping specialization
81
+ template<class... SliceSpecifiers>
82
+ constexpr auto submdspan-mapping-impl(SliceSpecifiers...) const // exposition only
83
+ -> see below;
84
+
85
+ template<class... SliceSpecifiers>
86
+ friend constexpr auto submdspan_mapping(const mapping& src, SliceSpecifiers... slices) {
87
+ return src.submdspan-mapping-impl(slices...);
88
+ }
89
+ };
90
+ }
91
+ ```
92
+
93
+ If `Extents` is not a specialization of `extents`, then the program is
94
+ ill-formed.
95
+
96
+ `layout_right_padded::mapping<E>` is a trivially copyable type that
97
+ models `regular` for each `E`.
98
+
99
+ Throughout [[mdspan.layout.rightpad]], let `P_rank` be the following
100
+ size *`rank_`* parameter pack of `size_`t values:
101
+
102
+ - the empty parameter pack, if *`rank_`* equals zero;
103
+ - otherwise, `0zu`, if *`rank_`* equals one;
104
+ - otherwise, the parameter pack `0zu`, `1zu`, …, `rank_- 1`.
105
+
106
+ *Mandates:*
107
+
108
+ - If `rank_dynamic() == 0` is `true`, then the size of the
109
+ multidimensional index space `Extents()` is representable as a value
110
+ of type `index_type`.
111
+ - `padding_value` is representable as a value of type `index_type`.
112
+ - If
113
+ - *`rank_`* is greater than one,
114
+ - `padding_value` does not equal `dynamic_extent`, and
115
+ - *`last-static-extent`* does not equal `dynamic_extent`,
116
+
117
+ then `LEAST-MULTIPLE-AT-LEAST(padding_value, last-static-extent)` is
118
+ representable as a value of type `size_t`, and is representable as a
119
+ value of type `index_type`.
120
+ - If
121
+ - *`rank_`* is greater than one,
122
+ - `padding_value` does not equal `dynamic_extent`, and
123
+ - `extents_type::static_extent(k)` does not equal `dynamic_extent` for
124
+ all k in the range \[`0`, *`rank_`*),
125
+
126
+ then the product of
127
+ `LEAST-MULTIPLE-AT-LEAST(padding_value, ext.static_extent(rank_ - 1))`
128
+ and all values `ext.static_extent(k)` with k in the range of \[`0`,
129
+ *`rank_`*` - 1`) is representable as a value of type `size_t`, and is
130
+ representable as a value of type `index_type`.
131
+