From Jason Turner

[mdspan.layout.stride.expo]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpuj19sa87/{from.md → to.md} +50 -0
tmp/tmpuj19sa87/{from.md → to.md} RENAMED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ###### Exposition-only helpers <a id="mdspan.layout.stride.expo">[[mdspan.layout.stride.expo]]</a>
2
+
3
+ Let `REQUIRED-SPAN-SIZE(e, strides)` be:
4
+
5
+ - `1`, if `e.rank() == 0` is `true`,
6
+ - otherwise `0`, if the size of the multidimensional index space `e` is
7
+ 0,
8
+ - otherwise `1` plus the sum of products of `(e.extent(r) - 1)` and
9
+ `strides[r]` for all r in the range [0, `e.rank()`).
10
+
11
+ Let `OFFSET(m)` be:
12
+
13
+ - `m()`, if `e.rank() == 0` is `true`,
14
+ - otherwise `0`, if the size of the multidimensional index space `e` is
15
+ 0,
16
+ - otherwise `m(z...)` for a pack of integers `z` that is a
17
+ multidimensional index in `m.extents()` and each element of `z` equals
18
+ 0.
19
+
20
+ Let *`is-extents`* be the exposition-only variable template defined as
21
+ follows:
22
+
23
+ ``` cpp
24
+ template<class T>
25
+ constexpr bool is-extents = false; // exposition only
26
+ template<class IndexType, size_t... Args>
27
+ constexpr bool is-extents<extents<IndexType, Args...>> = true; // exposition only
28
+ ```
29
+
30
+ Let `layout-mapping-alike` be the exposition-only concept defined as
31
+ follows:
32
+
33
+ ``` cpp
34
+ template<class M>
35
+ concept layout-mapping-alike = requires { // exposition only
36
+ requires is-extents<typename M::extents_type>;
37
+ { M::is_always_strided() } -> same_as<bool>;
38
+ { M::is_always_exhaustive() } -> same_as<bool>;
39
+ { M::is_always_unique() } -> same_as<bool>;
40
+ bool_constant<M::is_always_strided()>::value;
41
+ bool_constant<M::is_always_exhaustive()>::value;
42
+ bool_constant<M::is_always_unique()>::value;
43
+ };
44
+ ```
45
+
46
+ [*Note 2*: This concept checks that the functions
47
+ `M::is_always_strided()`, `M::is_always_exhaustive()`, and
48
+ `M::is_always_unique()` exist, are constant expressions, and have a
49
+ return type of `bool`. — *end note*]
50
+