[mdspan.accessor.reqmts]

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

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

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

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

#### 23.7.3.5.2 Requirements [mdspan.accessor.reqmts]

[1](#1)

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

A type A meets the accessor policy requirements if

- [(1.1)](#1.1)

A models [copyable](concepts.object#concept:copyable "18.6 Object concepts [concepts.object]"),

- [(1.2)](#1.2)

is_nothrow_move_constructible_v<A> is true,

- [(1.3)](#1.3)

is_nothrow_move_assignable_v<A> is true,

- [(1.4)](#1.4)

is_nothrow_swappable_v<A> is true, and

- [(1.5)](#1.5)

the following types and expressions
are well-formed and have the specified semantics[.](#1.sentence-1)

[ð](#itemdecl:1)

`typename A::element_type
`

[2](#2)

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

*Result*: A complete object type that is not an abstract class type[.](#2.sentence-1)

[ð](#itemdecl:2)

`typename A::data_handle_type
`

[3](#3)

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

*Result*: A type that models [copyable](concepts.object#concept:copyable "18.6 Object concepts [concepts.object]"), and
for which is_nothrow_move_constructible_v<A​::​data_handle_type> is true,is_nothrow_move_assignable_v<A​::​data_handle_type> is true, andis_nothrow_swappable_v<A​::​data_handle_type> is true[.](#3.sentence-1)

[*Note [1](#note-1)*:

The type of data_handle_type need not be element_type*[.](#3.sentence-2)

â *end note*]

[ð](#itemdecl:3)

`typename A::reference
`

[4](#4)

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

*Result*: A type that models[common_reference_with](concept.commonref#concept:common_reference_with "18.4.5 Concept common_­reference_­with [concept.commonref]")<A​::​reference&&, A​::​element_type&>[.](#4.sentence-1)

[*Note [2](#note-2)*:

The type of reference need not be element_type&[.](#4.sentence-2)

â *end note*]

[ð](#itemdecl:4)

`typename A::offset_policy
`

[5](#5)

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

*Result*: A type OP such that:

- [(5.1)](#5.1)

OP meets the accessor policy requirements,

- [(5.2)](#5.2)

[constructible_from](concept.constructible#concept:constructible_from "18.4.11 Concept constructible_­from [concept.constructible]")<OP, const A&> is modeled, and

- [(5.3)](#5.3)

is_same_v<typename OP​::​element_type, typename A​::​element_type> is true[.](#5.sentence-1)

[ð](#itemdecl:5)

`a.access(p, i)
`

[6](#6)

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

*Result*: A​::​reference

[7](#7)

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

*Remarks*: The expression is equality preserving[.](#7.sentence-1)

[8](#8)

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

[*Note [3](#note-3)*:

Concrete accessor policies can impose preconditions for their access function[.](#8.sentence-1)

However, they might not[.](#8.sentence-2)

For example, an accessor wherep is span<A​::​element_type, dynamic_extent> andaccess(p, i) returns p[i % p.size()] does not need to impose a precondition on i[.](#8.sentence-3)

â *end note*]

[ð](#itemdecl:6)

`a.offset(p, i)
`

[9](#9)

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

*Result*: A​::​offset_policy​::​data_handle_type

[10](#10)

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

*Returns*: q such that for b being A​::​offset_policy(a), and
any integer n for which [0, n) is
an accessible range of p and a:

- [(10.1)](#10.1)

[0,nâi) is an accessible range of q and b; and

- [(10.2)](#10.2)

b.access(q, j) provides access to
the same element as a.access(p, i + j),
for every j in the range [0,nâi)[.](#10.sentence-1)

[11](#11)

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

*Remarks*: The expression is equality-preserving[.](#11.sentence-1)
