C++ named requirements: AccessorPolicy (since C++23)
From cppreference.com
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
C++ named requirements
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++17)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++17)
(C++20)
(C++20)
(C++20)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++14)
(C++14)
(C++11)
(C++11)
(C++17)
(C++14)
(C++20)
(C++20)
(C++23)
(C++23)
AccessorPolicy
(C++23)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
AccessorPolicy defines how elements are accessed from a given data handle to such elements and an index. It is used as a policy in std::mdspan to specify the access to a reference of an element using an underlying 1D index.
Contents
[edit] Requirements
A type A
satisfies AccessorPolicy if it models copyable
, and the following are true:
- std::is_nothrow_move_constructible_v <A>
- std::is_nothrow_move_assignable_v <A>
- std::is_nothrow_swappable_v <A>
And, given the following types and values, the expressions shown in the table below are valid and have the indicated semantics:
[edit] Legend
Type
Definition
A
an accessor policy type
OP
an offset policy type
Value
Definition
a
a value of type (possibly const-qualified)
A
p
a value of type (possibly const-qualified)
A::data_handle_type
[edit] Member types
Type | Definition | Requirements |
---|---|---|
A::element_type
|
unspecified |
|
A::data_handle_type
|
unspecified[1] |
|
A::reference
|
unspecified[2] |
|
A::offset_policy
|
OP
|
|
[edit] Member functions
Expression | Return type | Semantics |
---|---|---|
a.access(p, i) | typename A::reference |
|
a.offset(p, i) | typename A::offset_policy ::data_handle_type
|
|
[edit] Accessible range
A range of indices [
0,
N)
is an accessible range of a given data handle and an accessor if, for each index in the range, the access member function produces a valid reference to an element.
[edit] Standard library
The following standard library types satisfy AccessorPolicy requirements:
Defined in namespace
std::linalg
(C++26)
(class template) [edit]
(C++26)
(class template) [edit]