tmp/tmpuoka4pmf/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
###### Overview <a id="mdspan.layout.stride.overview">[[mdspan.layout.stride.overview]]</a>
|
| 2 |
+
|
| 3 |
+
`layout_stride` provides a layout mapping where the strides are
|
| 4 |
+
user-defined.
|
| 5 |
+
|
| 6 |
+
``` cpp
|
| 7 |
+
namespace std {
|
| 8 |
+
template<class Extents>
|
| 9 |
+
class layout_stride::mapping {
|
| 10 |
+
public:
|
| 11 |
+
using extents_type = Extents;
|
| 12 |
+
using index_type = typename extents_type::index_type;
|
| 13 |
+
using size_type = typename extents_type::size_type;
|
| 14 |
+
using rank_type = typename extents_type::rank_type;
|
| 15 |
+
using layout_type = layout_stride;
|
| 16 |
+
|
| 17 |
+
private:
|
| 18 |
+
static constexpr rank_type rank_ = extents_type::rank(); // exposition only
|
| 19 |
+
|
| 20 |
+
public:
|
| 21 |
+
// [mdspan.layout.stride.cons], constructors
|
| 22 |
+
constexpr mapping() noexcept;
|
| 23 |
+
constexpr mapping(const mapping&) noexcept = default;
|
| 24 |
+
template<class OtherIndexType>
|
| 25 |
+
constexpr mapping(const extents_type&, span<OtherIndexType, rank_>) noexcept;
|
| 26 |
+
template<class OtherIndexType>
|
| 27 |
+
constexpr mapping(const extents_type&, const array<OtherIndexType, rank_>&) noexcept;
|
| 28 |
+
|
| 29 |
+
template<class StridedLayoutMapping>
|
| 30 |
+
constexpr explicit(see below) mapping(const StridedLayoutMapping&) noexcept;
|
| 31 |
+
|
| 32 |
+
constexpr mapping& operator=(const mapping&) noexcept = default;
|
| 33 |
+
|
| 34 |
+
// [mdspan.layout.stride.obs], observers
|
| 35 |
+
constexpr const extents_type& extents() const noexcept { return extents_; }
|
| 36 |
+
constexpr array<index_type, rank_> strides() const noexcept { return strides_; }
|
| 37 |
+
|
| 38 |
+
constexpr index_type required_span_size() const noexcept;
|
| 39 |
+
|
| 40 |
+
template<class... Indices>
|
| 41 |
+
constexpr index_type operator()(Indices...) const noexcept;
|
| 42 |
+
|
| 43 |
+
static constexpr bool is_always_unique() noexcept { return true; }
|
| 44 |
+
static constexpr bool is_always_exhaustive() noexcept { return false; }
|
| 45 |
+
static constexpr bool is_always_strided() noexcept { return true; }
|
| 46 |
+
|
| 47 |
+
static constexpr bool is_unique() noexcept { return true; }
|
| 48 |
+
constexpr bool is_exhaustive() const noexcept;
|
| 49 |
+
static constexpr bool is_strided() noexcept { return true; }
|
| 50 |
+
|
| 51 |
+
constexpr index_type stride(rank_type i) const noexcept { return strides_[i]; }
|
| 52 |
+
|
| 53 |
+
template<class OtherMapping>
|
| 54 |
+
friend constexpr bool operator==(const mapping&, const OtherMapping&) noexcept;
|
| 55 |
+
|
| 56 |
+
private:
|
| 57 |
+
extents_type extents_{}; // exposition only
|
| 58 |
+
array<index_type, rank_> strides_{}; // exposition only
|
| 59 |
+
};
|
| 60 |
+
}
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
If `Extents` is not a specialization of `extents`, then the program is
|
| 64 |
+
ill-formed.
|
| 65 |
+
|
| 66 |
+
`layout_stride::mapping<E>` is a trivially copyable type that models
|
| 67 |
+
`regular` for each `E`.
|
| 68 |
+
|
| 69 |
+
*Mandates:* If `Extents::rank_dynamic() == 0` is `true`, then the size
|
| 70 |
+
of the multidimensional index space `Extents()` is representable as a
|
| 71 |
+
value of type `typename Extents::index_type`.
|
| 72 |
+
|