4.6 KiB
[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]
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
Result: A complete object type that is not an abstract class type.
typename A::data_handle_type
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
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
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)
Result: A::reference
Remarks: The expression is equality preserving.
[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)
Result: A::offset_policy::data_handle_type
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).
Remarks: The expression is equality-preserving.