Files
2025-10-25 03:02:53 +03:00

4.6 KiB
Raw Permalink Blame History

[mdspan.accessor.reqmts]

23 Containers library [containers]

23.7 Views [views]

23.7.3 Multidimensional access [views.multidim]

23.7.3.5 Accessor policy [mdspan.accessor]

23.7.3.5.2 Requirements [mdspan.accessor.reqmts]

1

#

A type A meets the accessor policy requirements if

A models copyable,

is_nothrow_move_constructible_v is true,

is_nothrow_move_assignable_v is true,

is_nothrow_swappable_v is true, and

the following types and expressions are well-formed and have the specified semantics.

🔗

typename A::element_type

2

#

Result: A complete object type that is not an abstract class type.

🔗

typename A::data_handle_type

3

#

Result: A type that models copyable, 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.

[Note 1:

The type of data_handle_type need not be element_type*.

— end note]

🔗

typename A::reference

4

#

Result: A type that modelscommon_reference_with<A::reference&&, A::element_type&>.

[Note 2:

The type of reference need not be element_type&.

— end note]

🔗

typename A::offset_policy

5

#

Result: A type OP such that:

OP meets the accessor policy requirements,

constructible_from<OP, const A&> is modeled, and

is_same_v<typename OP::element_type, typename A::element_type> is true.

🔗

a.access(p, i)

6

#

Result: A::reference

7

#

Remarks: The expression is equality preserving.

8

#

[Note 3:

Concrete accessor policies can impose preconditions for their access function.

However, they might not.

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.

— end note]

🔗

a.offset(p, i)

9

#

Result: A::offset_policy::data_handle_type

10

#

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:

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

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).

11

#

Remarks: The expression is equality-preserving.