From Jason Turner

[mdspan.extents.cons]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp3et2pvfz/{from.md → to.md} +105 -0
tmp/tmp3et2pvfz/{from.md → to.md} RENAMED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ##### Constructors <a id="mdspan.extents.cons">[[mdspan.extents.cons]]</a>
2
+
3
+ ``` cpp
4
+ template<class OtherIndexType, size_t... OtherExtents>
5
+ constexpr explicit(see below)
6
+ extents(const extents<OtherIndexType, OtherExtents...>& other) noexcept;
7
+ ```
8
+
9
+ *Constraints:*
10
+
11
+ - `sizeof...(OtherExtents) == rank()` is `true`.
12
+ - `((OtherExtents == dynamic_extent || Extents == dynamic_extent || OtherExtents == Extents) && ...)`
13
+ is `true`.
14
+
15
+ *Preconditions:*
16
+
17
+ - `other.extent(`r`)` equals Eᵣ for each r for which Eᵣ is a static
18
+ extent, and
19
+ - either
20
+ - `sizeof...(OtherExtents)` is zero, or
21
+ - `other.extent(`r`)` is representable as a value of type `index_type`
22
+ for every rank index r of `other`.
23
+
24
+ *Ensures:* `*this == other` is `true`.
25
+
26
+ *Remarks:* The expression inside `explicit` is equivalent to:
27
+
28
+ ``` cpp
29
+ (((Extents != dynamic_extent) && (OtherExtents == dynamic_extent)) || ... ) ||
30
+ (numeric_limits<index_type>::max() < numeric_limits<OtherIndexType>::max())
31
+ ```
32
+
33
+ ``` cpp
34
+ template<class... OtherIndexTypes>
35
+ constexpr explicit extents(OtherIndexTypes... exts) noexcept;
36
+ ```
37
+
38
+ Let `N` be `sizeof...(OtherIndexTypes)`, and let `exts_arr` be
39
+ `array<index_type, N>{static_cast<`
40
+ `index_type>(std::move(exts))...}`.
41
+
42
+ *Constraints:*
43
+
44
+ - `(is_convertible_v<OtherIndexTypes, index_type> && ...)` is `true`,
45
+ - `(is_nothrow_constructible_v<index_type, OtherIndexTypes> && ...)` is
46
+ `true`, and
47
+ - `N == rank_dynamic() || N == rank()` is `true`. \[*Note 1*: One can
48
+ construct `extents` from just dynamic extents, which are all the
49
+ values getting stored, or from all the extents with a
50
+ precondition. — *end note*]
51
+
52
+ *Preconditions:*
53
+
54
+ - If `N != rank_dynamic()` is `true`, `exts_arr[`r`]` equals Eᵣ for each
55
+ r for which Eᵣ is a static extent, and
56
+ - either
57
+ - `sizeof...(exts) == 0` is `true`, or
58
+ - each element of `exts` is nonnegative and is representable as a
59
+ value of type `index_type`.
60
+
61
+ *Ensures:* `*this == extents(exts_arr)` is `true`.
62
+
63
+ ``` cpp
64
+ template<class OtherIndexType, size_t N>
65
+ constexpr explicit(N != rank_dynamic())
66
+ extents(span<OtherIndexType, N> exts) noexcept;
67
+ template<class OtherIndexType, size_t N>
68
+ constexpr explicit(N != rank_dynamic())
69
+ extents(const array<OtherIndexType, N>& exts) noexcept;
70
+ ```
71
+
72
+ *Constraints:*
73
+
74
+ - `is_convertible_v<const OtherIndexType&, index_type>` is `true`,
75
+ - `is_nothrow_constructible_v<index_type, const OtherIndexType&>` is
76
+ `true`, and
77
+ - `N == rank_dynamic() || N == rank()` is `true`.
78
+
79
+ *Preconditions:*
80
+
81
+ - If `N != rank_dynamic()` is `true`, `exts[`r`]` equals Eᵣ for each r
82
+ for which Eᵣ is a static extent, and
83
+ - either
84
+ - `N` is zero, or
85
+ - `exts[`r`]` is nonnegative and is representable as a value of type
86
+ `index_type` for every rank index r.
87
+
88
+ *Effects:*
89
+
90
+ - If `N` equals `dynamic_rank()`, for all d in the range
91
+ [0, `rank_dynamic()`), direct-non-list-initializes
92
+ *`dynamic-extents`*`[`d`]` with `as_const(exts[`d`])`.
93
+ - Otherwise, for all d in the range [0, `rank_dynamic()`),
94
+ direct-non-list-initializes *`dynamic-extents`*`[`d`]` with
95
+ `as_const(exts[`*`dynamic-index-inv`*`(`d`)])`.
96
+
97
+ ``` cpp
98
+ template<class... Integrals>
99
+ explicit extents(Integrals...) -> see below;
100
+ ```
101
+
102
+ *Constraints:* `(is_convertible_v<Integrals, size_t> && ...)` is `true`.
103
+
104
+ *Remarks:* The deduced type is `dextents<size_t, sizeof...(Integrals)>`.
105
+