From Jason Turner

[mdspan.extents.expo]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpk4n0z5ik/{from.md → to.md} +55 -0
tmp/tmpk4n0z5ik/{from.md → to.md} RENAMED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ##### Exposition-only helpers <a id="mdspan.extents.expo">[[mdspan.extents.expo]]</a>
2
+
3
+ ``` cpp
4
+ static constexpr rank_type dynamic-index(rank_type i) noexcept;
5
+ ```
6
+
7
+ *Preconditions:* `i <= rank()` is `true`.
8
+
9
+ *Returns:* The number of Eᵣ with r < `i` for which Eᵣ is a dynamic
10
+ extent.
11
+
12
+ ``` cpp
13
+ static constexpr rank_type dynamic-index-inv(rank_type i) noexcept;
14
+ ```
15
+
16
+ *Preconditions:* `i < rank_dynamic()` is `true`.
17
+
18
+ *Returns:* The minimum value of r such that
19
+ *`dynamic-index`*`(`r` + 1) == i + 1` is `true`.
20
+
21
+ ``` cpp
22
+ constexpr size_t fwd-prod-of-extents(rank_type i) const noexcept;
23
+ ```
24
+
25
+ *Preconditions:* `i <= rank()` is `true`.
26
+
27
+ *Returns:* If `i > 0` is `true`, the product of `extent(`k`)` for all k
28
+ in the range [0, `i`), otherwise `1`.
29
+
30
+ ``` cpp
31
+ constexpr size_t rev-prod-of-extents(rank_type i) const noexcept;
32
+ ```
33
+
34
+ *Preconditions:* `i < rank()` is `true`.
35
+
36
+ *Returns:* If `i + 1 < rank()` is `true`, the product of `extent(`k`)`
37
+ for all k in the range [`i + 1`, `rank()`), otherwise `1`.
38
+
39
+ ``` cpp
40
+ template<class OtherIndexType>
41
+ static constexpr auto index-cast(OtherIndexType&& i) noexcept;
42
+ ```
43
+
44
+ *Effects:*
45
+
46
+ - If `OtherIndexType` is an integral type other than `bool`, then
47
+ equivalent to `return i;`,
48
+ - otherwise, equivalent to `return static_cast<index_type>(i);`.
49
+
50
+ [*Note 1*: This function will always return an integral type other than
51
+ `bool`. Since this function’s call sites are constrained on
52
+ convertibility of `OtherIndexType` to `index_type`, integer-class types
53
+ can use the `static_cast` branch without loss of
54
+ precision. — *end note*]
55
+