[mdspan.accessor.reqmts] (original) (raw)
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<A> is true,
- is_nothrow_move_assignable_v<A> is true,
- is_nothrow_swappable_v<A> is true, and
- the following types and expressions are well-formed and have the specified semantics.
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_]
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.
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_]
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:
- 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 .
Remarks: The expression is equality-preserving.