Loading...
Searching...
No Matches
Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy > Class Template Reference
Common » Utilities » C++ utilities and backports

A multi-dimensional non-owning array view. More...

`#include <dune/common/std/mdspan.hh>`

Inheritance diagram for Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >:

## Public Types

using | element_type = Element
using | extents_type = Extents
using | layout_type = LayoutPolicy
using | accessor_type = AccessorPolicy
using | value_type = std::remove_cv_t<Element>
using | mapping_type = typename layout_type::template mapping<extents_type>
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 | data_handle_type = typename accessor_type::data_handle_type
using | reference = typename accessor_type::reference

## Public Member Functions

constexpr const mapping_type & | mapping () const noexcept
| Index mapping of a layout policy.
constexpr const accessor_type & | accessor () const noexcept
| The accessor policy object.
constexpr const data_handle_type & | data_handle () const noexcept
| The pointer to the underlying flat sequence.
constexpr bool | is_unique () const
| Return true only if for every i and j where (i != j || ...) => mapping(i...) != mapping(j...).
constexpr bool | is_exhaustive () const
| Return true only if for all k in the range [0, mapping.required_span_size() ) there exists an i such that mapping(i...) equals k.
constexpr bool | is_strided () const
| Return true only if for every rank index r of extents there exists an integer sr such that, for all i where (i+dr) is a multidimensional index in extents, mapping((i+dr)...) - mapping(i...) equals sr. *.
constexpr index_type | stride (rank_type r) const
| The stride along the specified dimension.

## Static Public Member Functions

static constexpr bool | is_always_unique ()
| Return true only if for every i and j where (i != j || ...) => mapping(i...) != mapping(j...).
static constexpr bool | is_always_exhaustive ()
| Return true only if for all k in the range [0, mapping.required_span_size() ) there exists an i such that mapping(i...) equals k.
static constexpr bool | is_always_strided ()
| Return true only if for every rank index r of extents there exists an integer sr such that, for all i where (i+dr) is a multidimensional index in extents, mapping((i+dr)...) - mapping(i...) equals sr. *.

## Friends

constexpr void | swap (mdspan &x, mdspan &y) noexcept
| Overloads the std::swap algorithm for std::mdspan. Exchanges the state of x with that of y.

## Related Symbols

(Note that these are not member symbols.)
constexpr const extents_type & | extents () const noexcept
| Number of elements in all dimensions of the tensor,.

## mdspan constructors [mdspan.mdspan.cons]

template<class E = extents_type, class D = data_handle_type, class M = mapping_type, class A = accessor_type, std::enable_if_t<(E::rank_dynamic() > 0), int > = 0, std::enable_if_t< std::is_default_constructible_v< D >, int > = 0, std::enable_if_t< std::is_default_constructible_v< M >, int > = 0, std::enable_if_t< std::is_default_constructible_v< A >, int > = 0>
constexpr | mdspan ()
| Default constructor value-initializes all members.

template<class... IndexTypes, class E = extents_type, class M = mapping_type, class A = accessor_type, std::enable_if_t<(sizeof...(IndexTypes)==E::rank()||sizeof...(IndexTypes)==E::rank_dynamic()), int > = 0, std::enable_if_t<(... &&std::is_convertible_v< IndexTypes, index_type >), int > = 0, std::enable_if_t<(... &&std::is_nothrow_constructible_v< index_type, IndexTypes >), int > = 0, std::enable_if_t< std::is_constructible_v< M, E >, int > = 0, std::enable_if_t< std::is_default_constructible_v< A >, int > = 0>

constexpr | mdspan (data_handle_type p, IndexTypes... exts)
| Construct from the dynamic extents given as variadic list.
template<class IndexType, std::size_t N, std::enable_if_t< std::is_convertible_v< const IndexType &, index_type >, int > = 0, std::enable_if_t< std::is_nothrow_constructible_v< index_type, const IndexType & >, int > = 0, std::enable_if_t<(N==extents_type::rank_dynamic()||N==extents_type::rank()), int > = 0>
constexpr | mdspan (data_handle_type p, std::span< IndexType, N > exts)
| Construct from the dynamic extents given as an array.
template<class IndexType, std::size_t N, std::enable_if_t< std::is_convertible_v< IndexType, index_type >, int > = 0, std::enable_if_t<(N==extents_type::rank_dynamic()||N==extents_type::rank()), int > = 0>
constexpr | mdspan (data_handle_type p, const std::array< IndexType, N > &exts)
| Construct from the dynamic extents given as an array.
template<class M = mapping_type, std::enable_if_t< std::is_constructible_v< M, const extents_type & >, int > = 0>
constexpr | mdspan (data_handle_type p, const extents_type &e)
| Construct from the pointer to the data of the tensor and its extents.
template<class A = accessor_type, std::enable_if_t< std::is_default_constructible_v< A >, int > = 0>
constexpr | mdspan (data_handle_type p, const mapping_type &m)
| Construct from the pointer to the data of the tensor and an index mapping.
constexpr | mdspan (data_handle_type p, const mapping_type &m, const accessor_type &a)
| Construct from the pointer to the data of the tensor, an index mapping, and an accessor.
template<class OtherElementType, class OtherExtends, class OtherLayoutPolicy, class OtherAccessor, std::enable_if_t< std::is_constructible_v< mapping_type, const typename OtherLayoutPolicy::template mapping< OtherExtends > & >, int > = 0, std::enable_if_t< std::is_constructible_v< accessor_type, const OtherAccessor & >, int > = 0>
constexpr | mdspan (const mdspan< OtherElementType, OtherExtends, OtherLayoutPolicy, OtherAccessor > &other) noexcept
| Converting constructor.

## Multi index access

template<class... Indices, std::enable_if_t<(sizeof...(Indices)==extents_type::rank()), int > = 0, std::enable_if_t<(... &&std::is_convertible_v< Indices, index_type >), int > = 0, std::enable_if_t<(... &&std::is_nothrow_constructible_v< index_type, Indices >), int > = 0>
constexpr reference | operator() (Indices... indices) const
| Access specified element at position i0,i1,...
template<class Index, class E = extents_type, std::enable_if_t< std::is_convertible_v< Index, index_type >, int > = 0, std::enable_if_t<(E::rank()==1), int > = 0>
constexpr reference | operator[] (Index index) const
| Access specified element at position [i0] For a rank one mdspan, the operator[i] is added to support bracket access before __cpp_multidimensional_subscript is supported.
template<class Index, std::enable_if_t< std::is_convertible_v< const Index &, index_type >, int > = 0, std::enable_if_t< std::is_nothrow_constructible_v< index_type, const Index & >, int > = 0>
constexpr reference | operator[] (std::span< Index, extents_type::rank()> indices) const
| Access specified element at position [i0,i1,...].
template<class Index, std::enable_if_t< std::is_convertible_v< const Index &, index_type >, int > = 0, std::enable_if_t< std::is_nothrow_constructible_v< index_type, const Index & >, int > = 0>
constexpr reference | operator[] (const std::array< Index, extents_type::rank()> &indices) const
| Access specified element at position [i0,i1,...].

## Size information

constexpr index_type | extent (rank_type r) const noexcept
| Number of elements in the r'th dimension of the tensor.
constexpr size_type | size () const noexcept
| The number of elements accessible by this multi-dimensional span.
constexpr bool | empty () const noexcept
| Checks if the size of the index space is zero.
static constexpr rank_type | rank () noexcept
| Number of dimensions of the tensor.
static constexpr rank_type | rank_dynamic () noexcept
| Number of dimensions of the tensor.
static constexpr std::size_t | static_extent (rank_type r) noexcept
| Number of elements in the r'th dimension of the tensor.

## Detailed Description

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>
class Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >

A multi-dimensional non-owning array view.

The class mdspan is a view into a contiguous sequence of objects that reinterprets it as a multidimensional array.

The implementation is based in the standard proposal P0009r17 and the C++ standard working draft N4971.

Example:

std::vector v{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
// view data as contiguous memory representing 2 rows and 5 columns
// with row-major ordering.
auto ms = Dune::Std::mdspan(v.data(), 2, 5);
// write data using 2D view
for (std::size_t i = 0; i != ms.extent(0); i++)
for (std::size_t j = 0; j != ms.extent(1); j++)
ms(i, j) = i + j; // or ms[i, j]
Dune::Std::mdspan
mdspan(CArray &) -> mdspan< std::remove_all_extents_t< CArray >, Std::extents< std::size_t, std::extent_v< CArray, 0 > > >

Note
  The interface of Std::mdspan provides the operator[] with multiple indices overload only if available in c++23. For older c++ versions the operator() overload is implemented.

Template Parameters

  Element | The element type; a complete object type that is neither an abstract class type nor an array type.
  Extents | Specifies number of dimensions, their sizes, and which are known at compile time. Must be a specialization of Std::extents.
  LayoutPolicy | Specifies how to convert multi-dimensional index to underlying flat index.
  AccessorPolicy | Specifies how to convert underlying 1D index to a reference to Element.

## Member Typedef Documentation

## accessor_type

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>

using Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::accessor_type = AccessorPolicy

## data_handle_type

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>

using Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::data_handle_type = typename accessor_type::data_handle_type

## element_type

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>

using Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::element_type = Element

## extents_type

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>

using Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::extents_type = Extents

## index_type

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>

using Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::index_type = typename extents_type::index_type

## layout_type

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>

using Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::layout_type = LayoutPolicy

## mapping_type

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>

using Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::mapping_type = typename layout_type::template mapping<extents_type>

## rank_type

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>

using Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::rank_type = typename extents_type::rank_type

## reference

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>

using Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::reference = typename accessor_type::reference

## size_type

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>

using Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::size_type = typename extents_type::size_type

## value_type

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>

using Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::value_type = std::remove_cv_t<Element>

## Constructor & Destructor Documentation

## mdspan() [1/8]

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>
template<class E = extents_type, class D = data_handle_type, class M = mapping_type, class A = accessor_type, std::enable_if_t<(E::rank_dynamic() > 0), int > = 0, std::enable_if_t< std::is_default_constructible_v< D >, int > = 0, std::enable_if_t< std::is_default_constructible_v< M >, int > = 0, std::enable_if_t< std::is_default_constructible_v< A >, int > = 0>

Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::mdspan | ( |  | ) |

inline constexpr

Default constructor value-initializes all members.

## mdspan() [2/8]

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>
template<class... IndexTypes, class E = extents_type, class M = mapping_type, class A = accessor_type, std::enable_if_t<(sizeof...(IndexTypes)==E::rank()||sizeof...(IndexTypes)==E::rank_dynamic()), int > = 0, std::enable_if_t<(... &&std::is_convertible_v< IndexTypes, index_type >), int > = 0, std::enable_if_t<(... &&std::is_nothrow_constructible_v< index_type, IndexTypes >), int > = 0, std::enable_if_t< std::is_constructible_v< M, E >, int > = 0, std::enable_if_t< std::is_default_constructible_v< A >, int > = 0>

Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::mdspan | ( | data_handle_type | p,
|  | IndexTypes... | exts )

inline explicit constexpr

Construct from the dynamic extents given as variadic list.

## mdspan() [3/8]

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>
template<class IndexType, std::size_t N, std::enable_if_t< std::is_convertible_v< const IndexType &, index_type >, int > = 0, std::enable_if_t< std::is_nothrow_constructible_v< index_type, const IndexType & >, int > = 0, std::enable_if_t<(N==extents_type::rank_dynamic()||N==extents_type::rank()), int > = 0>

Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::mdspan | ( | data_handle_type | p,
|  | std::span< IndexType, N > | exts )

inline constexpr

Construct from the dynamic extents given as an array.

## mdspan() [4/8]

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>
template<class IndexType, std::size_t N, std::enable_if_t< std::is_convertible_v< IndexType, index_type >, int > = 0, std::enable_if_t<(N==extents_type::rank_dynamic()||N==extents_type::rank()), int > = 0>

Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::mdspan | ( | data_handle_type | p,
|  | const std::array< IndexType, N > & | exts )

inline constexpr

Construct from the dynamic extents given as an array.

## mdspan() [5/8]

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>
template<class M = mapping_type, std::enable_if_t< std::is_constructible_v< M, const extents_type & >, int > = 0>

Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::mdspan | ( | data_handle_type | p,
|  | const extents_type & | e )

inline constexpr

Construct from the pointer to the data of the tensor and its extents.

## mdspan() [6/8]

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>
template<class A = accessor_type, std::enable_if_t< std::is_default_constructible_v< A >, int > = 0>

Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::mdspan | ( | data_handle_type | p,
|  | const mapping_type & | m )

inline constexpr

Construct from the pointer to the data of the tensor and an index mapping.

## mdspan() [7/8]

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>

Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::mdspan | ( | data_handle_type | p,
|  | const mapping_type & | m,
|  | const accessor_type & | a )

inline constexpr

Construct from the pointer to the data of the tensor, an index mapping, and an accessor.

## mdspan() [8/8]

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>
template<class OtherElementType, class OtherExtends, class OtherLayoutPolicy, class OtherAccessor, std::enable_if_t< std::is_constructible_v< mapping_type, const typename OtherLayoutPolicy::template mapping< OtherExtends > & >, int > = 0, std::enable_if_t< std::is_constructible_v< accessor_type, const OtherAccessor & >, int > = 0>

Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::mdspan | ( | const mdspan< OtherElementType, OtherExtends, OtherLayoutPolicy, OtherAccessor > & | other | ) |

inline constexpr noexcept

Converting constructor.

## Member Function Documentation

## accessor()

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>

const accessor_type & Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::accessor | ( |  | ) | const

inline constexpr noexcept

The accessor policy object.

## data_handle()

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>

const data_handle_type & Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::data_handle | ( |  | ) | const

inline constexpr noexcept

The pointer to the underlying flat sequence.

## empty()

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>

bool Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::empty | ( |  | ) | const

inline nodiscard constexpr noexcept

Checks if the size of the index space is zero.

## extent()

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>

index_type Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::extent | ( | rank_type | r | ) | const

inline constexpr noexcept

Number of elements in the r'th dimension of the tensor.

## is_always_exhaustive()

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>

constexpr bool Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::is_always_exhaustive | ( |  | ) |

inline static constexpr

Return true only if for all k in the range [0, mapping.required_span_size() ) there exists an i such that mapping(i...) equals k.

## is_always_strided()

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>

constexpr bool Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::is_always_strided | ( |  | ) |

inline static constexpr

Return true only if for every rank index r of extents there exists an integer sr such that, for all i where (i+dr) is a multidimensional index in extents, mapping((i+dr)...) - mapping(i...) equals sr. *.

Note
  This implies that for a strided layout mapping(i0, ..., ik) = mapping(0, ..., 0) + i0 * s0 + ... + ik * sk.

## is_always_unique()

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>

constexpr bool Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::is_always_unique | ( |  | ) |

inline static constexpr

Return true only if for every i and j where (i != j || ...) => mapping(i...) != mapping(j...).

## is_exhaustive()

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>

bool Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::is_exhaustive | ( |  | ) | const

inline constexpr

Return true only if for all k in the range [0, mapping.required_span_size() ) there exists an i such that mapping(i...) equals k.

## is_strided()

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>

bool Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::is_strided | ( |  | ) | const

inline constexpr

Return true only if for every rank index r of extents there exists an integer sr such that, for all i where (i+dr) is a multidimensional index in extents, mapping((i+dr)...) - mapping(i...) equals sr. *.

Note
  This implies that for a strided layout mapping(i0, ..., ik) = mapping(0, ..., 0) + i0 * s0 + ... + ik * sk.

## is_unique()

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>

bool Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::is_unique | ( |  | ) | const

inline constexpr

Return true only if for every i and j where (i != j || ...) => mapping(i...) != mapping(j...).

## mapping()

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>

const mapping_type & Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::mapping | ( |  | ) | const

inline constexpr noexcept

Index mapping of a layout policy.

## operator()()

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>
template<class... Indices, std::enable_if_t<(sizeof...(Indices)==extents_type::rank()), int > = 0, std::enable_if_t<(... &&std::is_convertible_v< Indices, index_type >), int > = 0, std::enable_if_t<(... &&std::is_nothrow_constructible_v< index_type, Indices >), int > = 0>

reference Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::operator() | ( | Indices... | indices | ) | const

inline constexpr

Access specified element at position i0,i1,...

Note
  The operator() is not in the std proposal, but is provided for using mdspan without c++23.

## operator[]() [1/3]

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>
template<class Index, std::enable_if_t< std::is_convertible_v< const Index &, index_type >, int > = 0, std::enable_if_t< std::is_nothrow_constructible_v< index_type, const Index & >, int > = 0>

reference Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::operator[] | ( | const std::array< Index, extents_type::rank()> & | indices | ) | const

inline constexpr

Access specified element at position [i0,i1,...].

## operator[]() [2/3]

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>
template<class Index, class E = extents_type, std::enable_if_t< std::is_convertible_v< Index, index_type >, int > = 0, std::enable_if_t<(E::rank()==1), int > = 0>

reference Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::operator[] | ( | Index | index | ) | const

inline constexpr

Access specified element at position [i0] For a rank one mdspan, the operator[i] is added to support bracket access before __cpp_multidimensional_subscript is supported.

## operator[]() [3/3]

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>
template<class Index, std::enable_if_t< std::is_convertible_v< const Index &, index_type >, int > = 0, std::enable_if_t< std::is_nothrow_constructible_v< index_type, const Index & >, int > = 0>

reference Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::operator[] | ( | std::span< Index, extents_type::rank()> | indices | ) | const

inline constexpr

Access specified element at position [i0,i1,...].

## rank()

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>

constexpr rank_type Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::rank | ( |  | ) |

inline static constexpr noexcept

Number of dimensions of the tensor.

## rank_dynamic()

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>

constexpr rank_type Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::rank_dynamic | ( |  | ) |

inline static constexpr noexcept

Number of dimensions of the tensor.

## size()

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>

size_type Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::size | ( |  | ) | const

inline constexpr noexcept

The number of elements accessible by this multi-dimensional span.

## static_extent()

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>

constexpr std::size_t Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::static_extent | ( | rank_type | r | ) |

inline static constexpr noexcept

Number of elements in the r'th dimension of the tensor.

## stride()

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>

index_type Dune::Std::mdspan< Element, Extents, LayoutPolicy, AccessorPolicy >::stride | ( | rank_type | r | ) | const

inline constexpr

The stride along the specified dimension.

## Friends And Related Symbol Documentation

## extents()

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>

const extents_type & extents | ( |  | ) | const

related

Number of elements in all dimensions of the tensor,.

## swap

template<class Element, class Extents, class LayoutPolicy = Std::layout_right, class AccessorPolicy = Std::default_accessor<Element>>

void swap | ( | mdspan< Element, Extents, LayoutPolicy, AccessorPolicy > & | x,
|  | mdspan< Element, Extents, LayoutPolicy, AccessorPolicy > & | y )

friend

Overloads the std::swap algorithm for std::mdspan. Exchanges the state of x with that of y.

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

- mdspan.hh