|
| 1 | +# submdspan_mapping |
| 2 | +* mdspan[meta header] |
| 3 | +* function template[meta id-type] |
| 4 | +* std[meta namespace] |
| 5 | +* layout_right::mapping[meta class] |
| 6 | +* cpp23[meta cpp] |
| 7 | + |
| 8 | +```cpp |
| 9 | +template<class... SliceSpecifiers> |
| 10 | +constexpr auto submdspan-mapping-impl( // exposition only |
| 11 | + SliceSpecifiers ... slices) const -> see below; |
| 12 | + |
| 13 | +template<class... SliceSpecifiers> |
| 14 | +friend constexpr auto submdspan_mapping( |
| 15 | + const mapping& src, SliceSpecifiers... slices) |
| 16 | +{ |
| 17 | + return src.submdspan-mapping-impl(slices...); |
| 18 | +} |
| 19 | +``` |
| 20 | +* see below[italic] |
| 21 | +* submdspan-mapping-impl[italic] |
| 22 | +
|
| 23 | +## 概要 |
| 24 | +[`submdspan`](../../submdspan.md)関数をサポートするためのカスタマイゼーションポイント。 |
| 25 | +
|
| 26 | +説明用の型`index_type`を[`Extents::index_type`](../../extents.md)、型`S_k`を`SliceSpecifiers`の`k`番目の型とする。 |
| 27 | +
|
| 28 | +
|
| 29 | +## テンプレートパラメータ制約 |
| 30 | +`sizeof...(slices)`が[`Extents::rank()`](../../extents/rank.md)と等しいこと。 |
| 31 | +
|
| 32 | +
|
| 33 | +## 適格要件 |
| 34 | +`extents()`の各次元インデクス`k`において、下記いずれかのうち1つだけを満たすこと。 |
| 35 | +
|
| 36 | +- 型`S_k`が[`convertible_to`](/reference/concepts/convertible_to.md)`<index_type>`のモデル |
| 37 | +- 型`S_k`が[`index-pair-like`](../../index-pair-like.md)`<index_type>`のモデル |
| 38 | +- [`is_convertible_v`](/reference/type_traits/is_convertible.md)`<S_k,` [`full_extent_t`](../../full_extent_t.md)`>`が`true` |
| 39 | +- 型`S_k`が[`strided_slice`](../../strided_slice.md)の特殊化 |
| 40 | +
|
| 41 | +
|
| 42 | +## 事前条件 |
| 43 | +`extents()`の各次元インデクス`k`において、`s_k`を`slices`の`k`番目の値としたとき、下記を全て満たすこと。 |
| 44 | +
|
| 45 | +- 型`S_k`が[`strided_slice`](../../strided_slice.md)の特殊化のとき |
| 46 | + - `s_k.extent == 0`、または |
| 47 | + - `s_k.stride > 0` |
| 48 | +- `0` ≤ [`first_`](../../first_.md)`<index_type, k>(slices...)` ≤ [`last_`](../../last_.md)`<k>(extents(), slices...)` ≤ `extents().`[`extent(k)`](../../extents/extent.md) |
| 49 | +
|
| 50 | +
|
| 51 | +## 戻り値 |
| 52 | +説明用の値や型を次の通り定義する。 |
| 53 | +
|
| 54 | +- 値`sub_ext` : 式[`submdspan_extents`](../../submdspan_extents.md)`(extents(), slices...)`の結果 |
| 55 | +- 型`SubExtents` : `decltype(sub_ext)` |
| 56 | +- 値`sub_strides` : `extents()`の各次元インデクス`k`において、[`map-rank[k]`](../../submdspan_extents.md)が[`dynamic_extent`](/reference/span/dynamic_extent.md)ではない`k`に対し`sub_strides[map-rank[k]]`が下記を満たす、[`array`](/reference/array/array.md)`<SubExtents::index_type,` [`SubExtents::rank()`](../../extents/rank.md)`>`型の配列値 |
| 57 | + - 型`S_k`が[`strided_slice`](../../strided_slice.md)の特殊化かつ`s_k.stride < s_k.extent`の場合、[`stride(k)`](stride.md) `*` [`de-ice`](../../de-ice.md)`(s_k.stride)` |
| 58 | + - そうでなければ、[`stride(k)`](stride.md) |
| 59 | +- パラメータパック`P` : [`is_same_v`](/reference/type_traits/is_same.md)`<`[`make_index_sequence`](/reference/utility/make_index_sequence.md)`<rank()>,` [`index_sequence`](/reference/utility/index_sequence.md)`<P...>> == true` |
| 60 | +- 値`offset` : `size_t`型の値[`(*this)`](op_call.md)`(`[`first_`](../../first_.md)`<index_type, P>(slices...)...)` |
| 61 | +
|
| 62 | +説明専用の`submdspan-mapping-impl`関数テンプレートは下記の値を返す。 |
| 63 | +
|
| 64 | +- [`Extents::rank()`](../../extents/rank.md) `== 0`のとき、[`submdspan_mapping_result`](../../submdspan_mapping_result.md)`{*this, 0}` |
| 65 | +- 以下を満たすとき、[`submdspan_mapping_result`](../../submdspan_mapping_result.md)`{`[`layout_right::mapping`](../../layout_right.md)`(sub_ext), offset}` |
| 66 | + - 半開区間`[Extents::rank() - SubExtents::rank()+1, Extents::rank())`の値`k`に対して、[`is_convertible_v`](/reference/type_traits/is_convertible.md)`<S_k,` [`full_extent_t`](../../full_extent_t.md)`>`が`true`、かつ |
| 67 | + - `Extents::rank()-SubExtents::rank()`に等しい値`k`に対して、型`S_k`が[`index-pair-like`](../../index-pair-like.md)`<index_type>`のモデルもしくは[`is_convertible_v`](/reference/type_traits/is_convertible.md)`<S_k,` [`full_extent_t`](../../full_extent_t.md)`>`が`true` |
| 68 | +- [`submdspan_mapping_result`](../../submdspan_mapping_result.md)`{`[`layout_stride::mapping`](../../layout_stride.md)`(sub_ext, sub_strides), offset}` |
| 69 | +
|
| 70 | +
|
| 71 | +## バージョン |
| 72 | +### 言語 |
| 73 | +- C++23 |
| 74 | +
|
| 75 | +### 処理系 |
| 76 | +- [Clang](/implementation.md#clang): ?? |
| 77 | +- [GCC](/implementation.md#gcc): ?? |
| 78 | +- [ICC](/implementation.md#icc): ?? |
| 79 | +- [Visual C++](/implementation.md#visual_cpp): ?? |
| 80 | +
|
| 81 | +
|
| 82 | +## 関連項目 |
| 83 | +- [`submdspan`](../../submdspan.md) |
| 84 | +
|
| 85 | +
|
| 86 | +## 参照 |
| 87 | +- [P2630R4 Submdspan](https://open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2630r4.html) |
0 commit comments