• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

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

    履歴 編集

    function
    <mdspan>

    std::layout_right::mapping::required_span_size

    constexpr index_type required_span_size() const noexcept;
    

    概要

    メモリブロックに対する要素アクセス範囲を取得する。

    戻り値

    多次元配列サイズextents()に対して、全次元の要素数を乗算した値。 次元数が0の場合は、値1を返す。

    例外

    投げない

    #include <cassert>
    #include <mdspan>
    
    int main()
    {
      using Ext3x4 = std::extents<size_t, 3, 4>;
      using Mapping3x4 = std::layout_right::mapping<Ext3x4>;
      Mapping3x4 map1{};
      assert(map1.required_span_size() == 12);
    
      using Ext3D = std::dextents<size_t, 3>;
      using Mapping3D = std::layout_right::mapping<Ext3D>;
      Mapping3D map2{Ext3D{4, 3, 2}};
      assert(map2.required_span_size() == 24);
    }
    

    出力

    バージョン

    言語

    • C++23

    処理系

    参照