最終更新日時(UTC):
が更新

履歴 編集

function template
<mdspan>

std::layout_right::mapping::submdspan_mapping(C++26)

template<class... SliceSpecifiers>
constexpr auto submdspan-mapping-impl(  // exposition only
  SliceSpecifiers... slices) const -> see below;

template<class... SliceSpecifiers>
friend constexpr auto submdspan_mapping(
  const mapping& src, SliceSpecifiers... slices)
{
  return src.submdspan-mapping-impl(slices...);
}

概要

submdspan関数をサポートするためのカスタマイゼーションポイント。

テンプレートパラメータ制約

sizeof...(SliceSpecifiers)Extents::rank()と等しいこと。

適格要件

extents()の各次元インデクスkにおいて、SliceSpecifiers...[k]Extentsのk番目次元の有効submdspanスライス型(valid submdspan slice type)であること。

事前条件

extents()の各次元インデクスkにおいて、slices...[k]extents()のk番目次元の有効スライスであること。

戻り値

説明用の値や型を次の通り定義する。

  • sub_ext : 式submdspan_extents(extents(), slices...)の結果
  • SubExtents : decltype(sub_ext)
  • sub_strides : slices...[k]の型が縮約スライス型(collapsing slice type)ではないextents()の各次元インデクスkにおいてsub_strides[MAP_RANK(slices, k)]が下記を満たす、array<SubExtents::index_type, SubExtents::rank()>型の配列値
    • 説明用のsslices...[k]としたとき、sの型がstrided_sliceの特殊化かつs.stride < s.extentの場合、stride(k) * s.stride
    • そうでなければ、stride(k)
  • パックls : extents()の次元rに対して、r番目の要素がslices...[r]submdspanスライス範囲の下限に等しいindex_type型の値パック
  • offset : extents()における任意の次元インデクスkに対してls...[k]extents().extent(k)と等しいとき、required_span_size()に等しいsize_t型の値。そうでなければ、operator()に等しいsize_t型の値。

下記を満たす型Sを、単位ストライド幅スライス型と定義する。

  • Sstrided_sliceの特殊化であり、S::stride_typeconstant_wrapperの特殊化かつS::stride_type::value1、または
  • Sfull_extent_t

説明専用のsubmdspan-mapping-impl関数テンプレートは下記の値を返す。

  • Extents::rank() == 0のとき、submdspan_mapping_result{*this, 0}
  • SubExtents::rank() == 0のとき、submdspan_mapping_result{layout_right::mapping(sub_ext), offset}
  • 以下を満たすとき、submdspan_mapping_result{layout_right::mapping(sub_ext), offset}
    • 半開区間[Extents::rank() - SubExtents::rank()+1, Extents::rank())の値kに対して、SliceSpecifiers...[k]full_extent_tを表し、かつ
    • rank_-SubExtents::rank()に等しい値kに対して、SliceSpecifiers...[k]が単位ストライド幅スライス型である
  • 以下を満たすとき、submdspan_mapping_result{layout_right_padded<S_static>::mapping(sub_ext, stride(rank_-u-2)), offset}
    • SliceSpecifiers...[p]が単位ストライド幅スライス型となるrank_-1より小さい最大値pに対して、rank_-u-2pとなる値uを用いて
      • rank_-1に等しい値kに対して、SliceSpecifiers...[k]が単位ストライド幅スライス型であり、かつ
      • 半開区間[rank_-SubExtents::rank()-u+1, rank_-u-1)の値kに対して、SliceSpecifiers...[k]full_extent_tを表し、かつ
      • rank_-SubExtents::rank()-uに等しい値kに対して、SliceSpecifiers...[k]が単位ストライド幅スライス型である
    • ここで定数S_static
      • 半開区間[rank_-u-1, rank_)のいずれかの値kに対してstatic_extent(k)dynamic_extentのとき、dynamic_extent
      • そうでなければ、半開区間[rank_-u-1, rank_)の全ての値kに対してstatic_extent(k)を乗算した値
  • submdspan_mapping_result{layout_stride::mapping(sub_ext, sub_strides), offset}

バージョン

言語

  • C++26

処理系

関連項目

参照