|
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
LayoutMapping controls the mapping of a multidimensional index to a one-dimensional offset to data handle instd::mdspan.
Contents |
A typeM satisfiesLayoutMapping if it modelscopyable andequality_comparable, and the following aretrue:
And, given the following types and values, the expressions shown in the table below are valid and have the indicated semantics:
| Type | Definition |
M | a layout mapping class |
| Value | Definition |
| m | a value of type (possibly const-qualified)M |
| i,j | packs of (possibly const-qualified) integers that are multidimensional indices inm.extents() |
| r | a (possibly const-qualified) rank index oftypename M::extents_type |
| d_r | a pack of (possibly const-qualified) integers for whichsizeof...(d_r)== M::extents_type::rank() istrue, the element at rank indexr is equal to1, and all other elements are equal to0 |
| Name | Type | Requirements |
|---|---|---|
M::extents_type | Specialization of class templatestd::extents | |
M::index_type | typename M::extents_type::index_type | |
M::rank_type | typename M::extents_type::rank_type | |
M::layout_type | Layout mapping policyMP wheretypename MP::template mapping<E> isMfor some extents type E | LayoutMappingPolicy for whichM is mapping type ofMP |
| Expression | Return type | Semantics |
|---|---|---|
| m.extents() | consttypename M::extents_type& | Returns constant reference to associated multidimensional index space |
| m(i...) | typename M::index_type |
|
| m.required_span_size() | typename M::index_type |
|
| m.is_unique() | bool | Returnstrue only if for everyi andj where(i!= j|| ...) istrue,m(i...)!= m(j...) istrue.[note 1] |
| m.is_exhaustive() | bool | Returnstrue only if for allk in the range[0, m.required_span_size()), there exists ani such thatm(i...) equalsk.[note 2] |
| m.is_strided() | bool | Returnstrue only if for every rank indexr ofm.extents(), there exists an integers_r such that, for alli where(i+ d_r) is a multidimensional index inm.extents(),m((i+ d_r)...)- m(i...) equalss_r.[note 3] |
| m.stride(r) | typename M::index_type |
|
| M::is_always_unique() | bool |
|
| M::is_always_exhaustive() | bool |
|
| M::is_always_strided() | bool |
|
For the constraints uses understd::layout_stride::mapping, the following exposition-only concept is defined.
template<class M> concept/*layout-mapping-alike*/= requires | (exposition only*) | |
Defines the minimal usability constraints of theLayoutMapping requirement. This concept checks that the predicate mapping trait functions above exist, are constant expressions, and have a return type ofbool.
/*is-extents*/<E> istrue if and only ifE is a specialization ofstd::extents.
The following standard library types satisfyLayoutMapping requirements:
| a layout mapping oflayout_left (public member class template of std::layout_left)[edit] | |
| a layout mapping oflayout_right (public member class template of std::layout_right)[edit] | |
| a layout mapping oflayout_stride (public member class template of std::layout_stride)[edit] | |
| a layout mapping oflayout_left_padded (public member class template of std::layout_left_padded<PaddingValue>)[edit] | |
| a layout mapping oflayout_right_padded (public member class template of std::layout_right_padded<PaddingValue>)[edit] |