[mdspan.accessor.default]

# 23 Containers library [[containers]](./#containers)

## 23.7 Views [[views]](views#mdspan.accessor.default)

### 23.7.3 Multidimensional access [[views.multidim]](views.multidim#mdspan.accessor.default)

#### 23.7.3.5 Accessor policy [[mdspan.accessor]](mdspan.accessor#default)

#### 23.7.3.5.3 Class template default_accessor [mdspan.accessor.default]

#### [23.7.3.5.3.1](#overview) Overview [[mdspan.accessor.default.overview]](mdspan.accessor.default.overview)

namespace std {template<class ElementType>struct default_accessor {using offset_policy = default_accessor; using element_type = ElementType; using reference = ElementType&; using data_handle_type = ElementType*; constexpr default_accessor() noexcept = default; template<class OtherElementType>constexpr default_accessor(default_accessor<OtherElementType>) noexcept; constexpr reference access(data_handle_type p, size_t i) const noexcept; constexpr data_handle_type offset(data_handle_type p, size_t i) const noexcept; };}

[1](#overview-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L24382)

default_accessor meets the accessor policy requirements[.](#overview-1.sentence-1)

[2](#overview-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L24385)

ElementType is required to be a complete object type
that is neither an abstract class type nor an array type[.](#overview-2.sentence-1)

[3](#overview-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L24389)

Each specialization of default_accessor is
a trivially copyable type that models [semiregular](concepts.object#concept:semiregular "18.6 Object concepts [concepts.object]")[.](#overview-3.sentence-1)

[4](#overview-4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L24393)

[0,n) is an accessible range for
an object p of type data_handle_type and
an object of type default_accessor if and only if [p, p + n) is a valid range[.](#overview-4.sentence-1)

#### [23.7.3.5.3.2](#members) Members [[mdspan.accessor.default.members]](mdspan.accessor.default.members)

[ð](#lib:default_accessor,constructor)

`template<class OtherElementType>
  constexpr default_accessor(default_accessor<OtherElementType>) noexcept {}
`

[1](#members-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L24408)

*Constraints*: is_convertible_v<OtherElementType(*)[], element_type(*)[]> is true[.](#members-1.sentence-1)

[ð](#lib:access,default_accessor)

`constexpr reference access(data_handle_type p, size_t i) const noexcept;
`

[2](#members-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L24420)

*Effects*: Equivalent to: return p[i];

[ð](#lib:offset,default_accessor)

`constexpr data_handle_type offset(data_handle_type p, size_t i) const noexcept;
`

[3](#members-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L24431)

*Effects*: Equivalent to: return p + i;
