From Jason Turner

[mdspan.sub.map.common]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpmh69oaxy/{from.md → to.md} +54 -0
tmp/tmpmh69oaxy/{from.md → to.md} RENAMED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ###### Common <a id="mdspan.sub.map.common">[[mdspan.sub.map.common]]</a>
2
+
3
+ The following elements apply to all functions in [[mdspan.sub.map]].
4
+
5
+ *Constraints:* `sizeof...(slices)` equals `extents_type::rank()`.
6
+
7
+ *Mandates:* For each rank index k of `extents()`, exactly one of the
8
+ following is true:
9
+
10
+ - Sₖ models `convertible_to<index_type>`,
11
+ - Sₖ models `index-pair-like<index_type>`,
12
+ - `is_convertible_v<Sₖ, full_extent_t>` is `true`, or
13
+ - Sₖ is a specialization of `strided_slice`.
14
+
15
+ *Preconditions:* For each rank index k of `extents()`, all of the
16
+ following are `true`:
17
+
18
+ - if Sₖ is a specialization of `strided_slice`, `sₖ.extent` is equal to
19
+ zero or `sₖ.stride` is greater than zero; and
20
+ - $0 \leq \tcode{\exposid{first_}<index_type, $k$>(slices...)} \\
21
+ \hphantom{0 } \leq \tcode{\exposid{last_}<$k$>(extents(), slices...)} \\
22
+ \hphantom{0 } \leq \tcode{extents().extent($k$)}$
23
+
24
+ Let `sub_ext` be the result of `submdspan_extents(extents(), slices...)`
25
+ and let `SubExtents` be `decltype(sub_ext)`.
26
+
27
+ Let `sub_strides` be an
28
+ `array<SubExtents::index_type, SubExtents::rank()>` such that for each
29
+ rank index k of `extents()` for which `map-rank[k]` is not
30
+ `dynamic_extent`, `sub_strides[map-rank[k]]` equals:
31
+
32
+ - `stride(k) * de-ice(sₖ.stride)` if Sₖ is a specialization of
33
+ `strided_slice` and `sₖ.stride < sₖ.extent` is `true`;
34
+ - otherwise, `stride(k)`.
35
+
36
+ Let `P` be a parameter pack such that
37
+ `is_same_v<make_index_sequence<rank()>, index_sequence<P...>>` is
38
+ `true`.
39
+
40
+ If `first_<index_type, k>(slices...)` equals `extents().extent(k)` for
41
+ any rank index k of `extents()`, then let `offset` be a value of type
42
+ `size_t` equal to `(*this).required_span_size()`. Otherwise, let
43
+ `offset` be a value of type `size_t` equal to
44
+ `(*this)(first_<index_type, P>(slices...)...)`.
45
+
46
+ Given a layout mapping type `M`, a type `S` is a *unit-stride slice for
47
+ `M`* if
48
+
49
+ - `S` is a specialization of `strided_slice` where `S::stride_type`
50
+ models `integral-constant-like` and `S::stride_type::value` equals
51
+ `1`,
52
+ - `S` models `index-pair-like<M::index_type>`, or
53
+ - `is_convertible_v<S, full_extent_t>` is `true`.
54
+