tmp/tmppuru5q2o/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
##### Overview <a id="mdspan.extents.overview">[[mdspan.extents.overview]]</a>
|
| 2 |
+
|
| 3 |
+
The class template `extents` represents a multidimensional index space
|
| 4 |
+
of rank equal to `sizeof...(Extents)`. In subclause [[views]], `extents`
|
| 5 |
+
is used synonymously with multidimensional index space.
|
| 6 |
+
|
| 7 |
+
``` cpp
|
| 8 |
+
namespace std {
|
| 9 |
+
template<class IndexType, size_t... Extents>
|
| 10 |
+
class extents {
|
| 11 |
+
public:
|
| 12 |
+
using index_type = IndexType;
|
| 13 |
+
using size_type = make_unsigned_t<index_type>;
|
| 14 |
+
using rank_type = size_t;
|
| 15 |
+
|
| 16 |
+
// [mdspan.extents.obs], observers of the multidimensional index space
|
| 17 |
+
static constexpr rank_type rank() noexcept { return sizeof...(Extents); }
|
| 18 |
+
static constexpr rank_type rank_dynamic() noexcept { return dynamic-index(rank()); }
|
| 19 |
+
static constexpr size_t static_extent(rank_type) noexcept;
|
| 20 |
+
constexpr index_type extent(rank_type) const noexcept;
|
| 21 |
+
|
| 22 |
+
// [mdspan.extents.cons], constructors
|
| 23 |
+
constexpr extents() noexcept = default;
|
| 24 |
+
|
| 25 |
+
template<class OtherIndexType, size_t... OtherExtents>
|
| 26 |
+
constexpr explicit(see below)
|
| 27 |
+
extents(const extents<OtherIndexType, OtherExtents...>&) noexcept;
|
| 28 |
+
template<class... OtherIndexTypes>
|
| 29 |
+
constexpr explicit extents(OtherIndexTypes...) noexcept;
|
| 30 |
+
template<class OtherIndexType, size_t N>
|
| 31 |
+
constexpr explicit(N != rank_dynamic())
|
| 32 |
+
extents(span<OtherIndexType, N>) noexcept;
|
| 33 |
+
template<class OtherIndexType, size_t N>
|
| 34 |
+
constexpr explicit(N != rank_dynamic())
|
| 35 |
+
extents(const array<OtherIndexType, N>&) noexcept;
|
| 36 |
+
|
| 37 |
+
// [mdspan.extents.cmp], comparison operators
|
| 38 |
+
template<class OtherIndexType, size_t... OtherExtents>
|
| 39 |
+
friend constexpr bool operator==(const extents&,
|
| 40 |
+
const extents<OtherIndexType, OtherExtents...>&) noexcept;
|
| 41 |
+
|
| 42 |
+
// [mdspan.extents.expo], exposition-only helpers
|
| 43 |
+
constexpr size_t fwd-prod-of-extents(rank_type) const noexcept; // exposition only
|
| 44 |
+
constexpr size_t rev-prod-of-extents(rank_type) const noexcept; // exposition only
|
| 45 |
+
template<class OtherIndexType>
|
| 46 |
+
static constexpr auto index-cast(OtherIndexType&&) noexcept; // exposition only
|
| 47 |
+
|
| 48 |
+
private:
|
| 49 |
+
static constexpr rank_type dynamic-index(rank_type) noexcept; // exposition only
|
| 50 |
+
static constexpr rank_type dynamic-index-inv(rank_type) noexcept; // exposition only
|
| 51 |
+
array<index_type, rank_dynamic()> dynamic-extents{}; // exposition only
|
| 52 |
+
};
|
| 53 |
+
|
| 54 |
+
template<class... Integrals>
|
| 55 |
+
explicit extents(Integrals...)
|
| 56 |
+
-> see below;
|
| 57 |
+
}
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
*Mandates:*
|
| 61 |
+
|
| 62 |
+
- `IndexType` is a signed or unsigned integer type, and
|
| 63 |
+
- each element of `Extents` is either equal to `dynamic_extent`, or is
|
| 64 |
+
representable as a value of type `IndexType`.
|
| 65 |
+
|
| 66 |
+
Each specialization of `extents` models `regular` and is trivially
|
| 67 |
+
copyable.
|
| 68 |
+
|
| 69 |
+
Let Eᵣ be the rᵗʰ element of `Extents`. Eᵣ is a *dynamic extent* if it
|
| 70 |
+
is equal to `dynamic_extent`, otherwise Eᵣ is a *static extent*. Let Dᵣ
|
| 71 |
+
be the value of `dynamic-extents[dynamic-index(r)]` if Eᵣ is a dynamic
|
| 72 |
+
extent, otherwise Eᵣ.
|
| 73 |
+
|
| 74 |
+
The rᵗʰ interval of the multidimensional index space represented by an
|
| 75 |
+
`extents` object is [0, Dᵣ).
|
| 76 |
+
|