layout_transpose is an
mdspan layout mapping policy
that swaps the two indices, extents, and strides
of any
mdspan layout mapping policy
. namespace std::linalg {
template<class Layout>
class layout_transpose {
public:
using nested_layout_type = Layout;
template<class Extents>
struct mapping {
private:
using nested-mapping-type =
typename Layout::template mapping<transpose-extents-t<Extents>>;
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_transpose;
constexpr explicit mapping(const nested-mapping-type&);
constexpr const extents_type& extents() const noexcept { return extents_; }
constexpr index_type required_span_size() const
{ return nested-mapping_.required_span_size();
template<class Index0, class Index1>
constexpr index_type operator()(Index0 ind0, Index1 ind1) const
{ return nested-mapping_(ind1, ind0); }
constexpr const nested-mapping-type& nested_mapping() const noexcept
{ return nested-mapping_; }
static constexpr bool is_always_unique() noexcept
{ return nested-mapping-type::is_always_unique(); }
static constexpr bool is_always_exhaustive() noexcept
{ return nested-mapping-type::is_always_exhaustive(); }
static constexpr bool is_always_strided() noexcept
{ return nested-mapping-type::is_always_strided(); }
constexpr bool is_unique() const { return nested-mapping_.is_unique(); }
constexpr bool is_exhaustive() const { return nested-mapping_.is_exhaustive(); }
constexpr bool is_strided() const { return nested-mapping_.is_strided(); }
constexpr index_type stride(size_t r) const;
template<class OtherExtents>
friend constexpr bool operator==(const mapping& x, const mapping<OtherExtents>& y);
};
private:
nested-mapping-type nested-mapping_;
extents_type extents_;
};
}