tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
mdspan< ElementType, Extents, LayoutPolicy, AccessorPolicy > Struct Template Reference

#include <mdspan.hpp>

Public Types

using accessor_type = AccessorPolicy
 
using data_handle_type = typename accessor_type::data_handle_type
 
using element_type = ElementType
 
using extents_type = Extents
 
using index_type = typename extents_type::index_type
 
using layout_type = LayoutPolicy
 
using mapping_type = typename layout_type::template mapping<extents_type>
 
using rank_type = typename extents_type::rank_type
 
using reference = typename accessor_type::reference
 
using size_type = typename extents_type::size_type
 
using value_type = remove_cv_t<element_type>
 

Public Member Functions

constexpr mdspan ()
 
constexpr mdspan (data_handle_type ptr, extents_type const &ext)
 
constexpr mdspan (data_handle_type ptr, mapping_type const &m)
 
constexpr mdspan (data_handle_type ptr, mapping_type const &m, accessor_type const &a)
 
template<typename... OtherIndexTypes>
requires ((is_convertible_v<OtherIndexTypes, index_type> and ...) and (is_nothrow_constructible_v<index_type, OtherIndexTypes> and ...) and ((sizeof...(OtherIndexTypes) == rank()) || (sizeof...(OtherIndexTypes) == rank_dynamic())) and is_constructible_v<mapping_type, extents_type> and is_default_constructible_v<accessor_type>)
constexpr mdspan (data_handle_type ptr, OtherIndexTypes... exts)
 
constexpr mdspan (mdspan &&rhs)=default
 
constexpr mdspan (mdspan const &rhs)=default
 
span< OtherIndexType, N > _acc ()
 
array< OtherIndexType, N > const _acc ()
 
OtherAccessor const _acc (other.accessor())
 
span< OtherIndexType, N > _map (extents_type(exts))
 
array< OtherIndexType, N > const _map (extents_type(exts))
 
OtherAccessor const _map (other.mapping())
 
constexpr auto accessor () const noexcept -> accessor_type const &
 
constexpr auto data_handle () const noexcept -> data_handle_type const &
 
constexpr auto empty () const noexcept -> bool
 
template<typename OtherElement, typename OtherExtents, typename OtherLayout, typename OtherAccessor>
requires ((is_constructible_v<mapping_type, typename OtherLayout::template mapping<OtherExtents> const&> and is_constructible_v<accessor_type, OtherAccessor const&>))
 explicit ((not is_convertible_v< typename OtherLayout::template mapping< OtherExtents > const &, mapping_type > or not is_convertible_v< OtherAccessor const &, accessor_type >)) const expr mdspan(mdspan< OtherElement
 
template<typename OtherIndexType, size_t N>
requires (is_convertible_v<OtherIndexType const&, index_type> and is_nothrow_constructible_v<index_type, OtherIndexType const&> and (N == rank() or N == rank_dynamic()) and is_constructible_v<mapping_type, extents_type> and is_default_constructible_v<accessor_type>)
 explicit (N !=rank_dynamic()) const expr mdspan(data_handle_type p
 
template<typename OtherIndexType, size_t N>
requires (is_convertible_v<OtherIndexType const&, index_type> and is_nothrow_constructible_v<index_type, OtherIndexType const&> and (N == rank() or N == rank_dynamic()) and is_constructible_v<mapping_type, extents_type> and is_default_constructible_v<accessor_type>)
 explicit (N !=rank_dynamic()) const expr mdspan(data_handle_type p
 
constexpr auto extent (rank_type r) const noexcept -> index_type
 
constexpr auto extents () const noexcept -> extents_type const &
 
constexpr auto is_exhaustive () const -> bool
 
constexpr auto is_strided () const -> bool
 
constexpr auto is_unique () const -> bool
 
constexpr auto mapping () const noexcept -> mapping_type const &
 
template<typename... OtherIndexTypes>
requires ( (is_convertible_v<OtherIndexTypes, index_type> && ...) and (is_nothrow_constructible_v<index_type, OtherIndexTypes> && ...) and sizeof...(OtherIndexTypes) == rank() )
constexpr auto operator() (OtherIndexTypes... indices) const -> reference
 
template<typename OtherIndexType>
requires (is_convertible_v<OtherIndexType const&, index_type> and is_nothrow_constructible_v<index_type, OtherIndexType const&>)
constexpr auto operator[] (array< OtherIndexType, rank()> const &indices) const -> reference
 
template<typename OtherIndexType>
requires (is_convertible_v<OtherIndexType const&, index_type> and is_nothrow_constructible_v<index_type, OtherIndexType const&>)
constexpr auto operator[] (span< OtherIndexType, rank()> indices) const -> reference
 
constexpr auto size () const noexcept -> size_type
 
constexpr auto stride (rank_type r) const -> index_type
 

Static Public Member Functions

static constexpr auto is_always_exhaustive () -> bool
 
static constexpr auto is_always_strided () -> bool
 
static constexpr auto is_always_unique () -> bool
 
static constexpr auto rank () noexcept -> rank_type
 
static constexpr auto rank_dynamic () noexcept -> rank_type
 
static constexpr auto static_extent (rank_type r) noexcept -> size_t
 

Public Attributes

span< OtherIndexType, N > exts: _ptr(etl::move(p))
 
array< OtherIndexType, N > const & exts: _ptr(etl::move(p))
 
OtherAccessor const & other: _ptr(other.data_handle())
 
 OtherExtents
 
 OtherLayout
 

Member Typedef Documentation

◆ accessor_type

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
using accessor_type = AccessorPolicy

◆ data_handle_type

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
using data_handle_type = typename accessor_type::data_handle_type

◆ element_type

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
using element_type = ElementType

◆ extents_type

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
using extents_type = Extents

◆ index_type

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
using index_type = typename extents_type::index_type

◆ layout_type

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
using layout_type = LayoutPolicy

◆ mapping_type

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
using mapping_type = typename layout_type::template mapping<extents_type>

◆ rank_type

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
using rank_type = typename extents_type::rank_type

◆ reference

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
using reference = typename accessor_type::reference

◆ size_type

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
using size_type = typename extents_type::size_type

◆ value_type

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
using value_type = remove_cv_t<element_type>

Constructor & Destructor Documentation

◆ mdspan() [1/7]

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
mdspan ( )
inlineconstexpr

◆ mdspan() [2/7]

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
template<typename... OtherIndexTypes>
requires ((is_convertible_v<OtherIndexTypes, index_type> and ...) and (is_nothrow_constructible_v<index_type, OtherIndexTypes> and ...) and ((sizeof...(OtherIndexTypes) == rank()) || (sizeof...(OtherIndexTypes) == rank_dynamic())) and is_constructible_v<mapping_type, extents_type> and is_default_constructible_v<accessor_type>)
mdspan ( data_handle_type ptr,
OtherIndexTypes... exts )
inlineexplicitconstexpr

◆ mdspan() [3/7]

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
mdspan ( data_handle_type ptr,
extents_type const & ext )
inlineconstexpr

◆ mdspan() [4/7]

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
mdspan ( data_handle_type ptr,
mapping_type const & m )
inlineconstexpr

◆ mdspan() [5/7]

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
mdspan ( data_handle_type ptr,
mapping_type const & m,
accessor_type const & a )
inlineconstexpr

◆ mdspan() [6/7]

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
mdspan ( mdspan< ElementType, Extents, LayoutPolicy, AccessorPolicy > const & rhs)
constexprdefault

◆ mdspan() [7/7]

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
mdspan ( mdspan< ElementType, Extents, LayoutPolicy, AccessorPolicy > && rhs)
constexprdefault

Member Function Documentation

◆ _acc() [1/3]

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
span< OtherIndexType, N > _acc ( )
inline

◆ _acc() [2/3]

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
array< OtherIndexType, N > const _acc ( )
inline

◆ _acc() [3/3]

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
OtherAccessor const _acc ( other. accessor())
inline

◆ _map() [1/3]

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
span< OtherIndexType, N > _map ( extents_type(exts) )

◆ _map() [2/3]

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
array< OtherIndexType, N > const _map ( extents_type(exts) )

◆ _map() [3/3]

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
OtherAccessor const _map ( other. mapping())

◆ accessor()

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
auto accessor ( ) const -> accessor_type const&
inlinenodiscardconstexprnoexcept

◆ data_handle()

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
auto data_handle ( ) const -> data_handle_type const&
inlinenodiscardconstexprnoexcept

◆ empty()

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
auto empty ( ) const -> bool
inlinenodiscardconstexprnoexcept

◆ explicit() [1/3]

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
template<typename OtherElement, typename OtherExtents, typename OtherLayout, typename OtherAccessor>
requires ((is_constructible_v<mapping_type, typename OtherLayout::template mapping<OtherExtents> const&> and is_constructible_v<accessor_type, OtherAccessor const&>))
explicit ( (not is_convertible_v< typename OtherLayout::template mapping< OtherExtents > const &, mapping_type > or not is_convertible_v< OtherAccessor const &, accessor_type >) ) const

◆ explicit() [2/3]

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
template<typename OtherIndexType, size_t N>
requires (is_convertible_v<OtherIndexType const&, index_type> and is_nothrow_constructible_v<index_type, OtherIndexType const&> and (N == rank() or N == rank_dynamic()) and is_constructible_v<mapping_type, extents_type> and is_default_constructible_v<accessor_type>)
explicit ( N ! = rank_dynamic()) const

◆ explicit() [3/3]

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
template<typename OtherIndexType, size_t N>
requires (is_convertible_v<OtherIndexType const&, index_type> and is_nothrow_constructible_v<index_type, OtherIndexType const&> and (N == rank() or N == rank_dynamic()) and is_constructible_v<mapping_type, extents_type> and is_default_constructible_v<accessor_type>)
explicit ( N ! = rank_dynamic()) const

◆ extent()

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
auto extent ( rank_type r) const -> index_type
inlinenodiscardconstexprnoexcept

◆ extents()

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
auto extents ( ) const -> extents_type const&
inlinenodiscardconstexprnoexcept

◆ is_always_exhaustive()

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
constexpr auto is_always_exhaustive ( ) -> bool
inlinestaticnodiscardconstexpr

◆ is_always_strided()

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
constexpr auto is_always_strided ( ) -> bool
inlinestaticnodiscardconstexpr

◆ is_always_unique()

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
constexpr auto is_always_unique ( ) -> bool
inlinestaticnodiscardconstexpr

◆ is_exhaustive()

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
auto is_exhaustive ( ) const -> bool
inlinenodiscardconstexpr

◆ is_strided()

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
auto is_strided ( ) const -> bool
inlinenodiscardconstexpr

◆ is_unique()

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
auto is_unique ( ) const -> bool
inlinenodiscardconstexpr

◆ mapping()

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
auto mapping ( ) const -> mapping_type const&
inlinenodiscardconstexprnoexcept

◆ operator()()

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
template<typename... OtherIndexTypes>
requires ( (is_convertible_v<OtherIndexTypes, index_type> && ...) and (is_nothrow_constructible_v<index_type, OtherIndexTypes> && ...) and sizeof...(OtherIndexTypes) == rank() )
auto operator() ( OtherIndexTypes... indices) const -> reference
inlinenodiscardconstexpr

◆ operator[]() [1/2]

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
template<typename OtherIndexType>
requires (is_convertible_v<OtherIndexType const&, index_type> and is_nothrow_constructible_v<index_type, OtherIndexType const&>)
auto operator[] ( array< OtherIndexType, rank()> const & indices) const -> reference
inlinenodiscardconstexpr

◆ operator[]() [2/2]

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
template<typename OtherIndexType>
requires (is_convertible_v<OtherIndexType const&, index_type> and is_nothrow_constructible_v<index_type, OtherIndexType const&>)
auto operator[] ( span< OtherIndexType, rank()> indices) const -> reference
inlinenodiscardconstexpr

◆ rank()

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
constexpr auto rank ( ) -> rank_type
inlinestaticnodiscardconstexprnoexcept

◆ rank_dynamic()

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
constexpr auto rank_dynamic ( ) -> rank_type
inlinestaticnodiscardconstexprnoexcept

◆ size()

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
auto size ( ) const -> size_type
inlinenodiscardconstexprnoexcept

◆ static_extent()

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
constexpr auto static_extent ( rank_type r) -> size_t
inlinestaticnodiscardconstexprnoexcept

◆ stride()

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
auto stride ( rank_type r) const -> index_type
inlinenodiscardconstexpr

Member Data Documentation

◆ exts [1/2]

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
span<OtherIndexType, N> exts

◆ exts [2/2]

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
array<OtherIndexType, N> const& exts

◆ other

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
OtherAccessor const& other

◆ OtherExtents

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
OtherExtents

◆ OtherLayout

template<typename ElementType, typename Extents, typename LayoutPolicy = layout_right, typename AccessorPolicy = default_accessor<ElementType>>
OtherLayout

The documentation for this struct was generated from the following file: