From Jason Turner

[mdspan.layout.leftpad.overview]

Diff to HTML by rtfpessoa

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