layout_stride provides a layout mapping
where the strides are user-defined
. namespace std {
template<class Extents>
class layout_stride::mapping {
public:
using extents_type = Extents;
using index_type = typename extents_type::index_type;
using size_type = typename extents_type::size_type;
using rank_type = typename extents_type::rank_type;
using layout_type = layout_stride;
private:
static constexpr rank_type rank_ = extents_type::rank();
public:
constexpr mapping() noexcept;
constexpr mapping(const mapping&) noexcept = default;
template<class OtherIndexType>
constexpr mapping(const extents_type&, span<OtherIndexType, rank_>) noexcept;
template<class OtherIndexType>
constexpr mapping(const extents_type&, const array<OtherIndexType, rank_>&) noexcept;
template<class StridedLayoutMapping>
constexpr explicit(see below) mapping(const StridedLayoutMapping&) noexcept;
constexpr mapping& operator=(const mapping&) noexcept = default;
constexpr const extents_type& extents() const noexcept { return extents_; }
constexpr array<index_type, rank_> strides() const noexcept { return strides_; }
constexpr index_type required_span_size() const noexcept;
template<class... Indices>
constexpr index_type operator()(Indices...) const noexcept;
static constexpr bool is_always_unique() noexcept { return true; }
static constexpr bool is_always_exhaustive() noexcept { return false; }
static constexpr bool is_always_strided() noexcept { return true; }
static constexpr bool is_unique() noexcept { return true; }
constexpr bool is_exhaustive() const noexcept;
static constexpr bool is_strided() noexcept { return true; }
constexpr index_type stride(rank_type i) const noexcept { return strides_[i]; }
template<class OtherMapping>
friend constexpr bool operator==(const mapping&, const OtherMapping&) noexcept;
private:
extents_type extents_{};
array<index_type, rank_> strides_{};
template<class... SliceSpecifiers>
constexpr auto submdspan-mapping-impl(SliceSpecifiers...) const
-> see below;
template<class... SliceSpecifiers>
friend constexpr auto submdspan_mapping(
const mapping& src, SliceSpecifiers... slices) {
return src.submdspan-mapping-impl(slices...);
}
};
}