• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

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

    履歴 編集

    function
    <mdspan>

    std::layout_stride::mapping::is_exhaustive

    constexpr bool is_exhaustive() const noexcept;
    

    概要

    レイアウトマッピングのExhaustive特性を取得する。

    戻り値

    多次元インデクスの次元数をrank_としたとき

    • rank_ == 0のとき、trueを返す。
    • そうでなければ、取りうる全ての多次元インデクス値に対応する要素位置を考えたとき、アクセスされうる要素位置に隙間が生じないならばtrueを返す。
    • そうでなければ、falseを返す。

    例外

    投げない

    #include <cassert>
    #include <array>
    #include <mdspan>
    
    int main()
    {
      using Ext2x3 = std::extents<size_t, 2, 3>;
      using Mapping = std::layout_stride::mapping<Ext2x3>;
    
      Mapping map1{{}, std::array{3, 1}};
      assert(map1.is_exhaustive());
    
      Mapping map2{{}, std::array{4, 1}};
      assert(not map2.is_exhaustive());
    }
    

    出力

    バージョン

    言語

    • C++23

    処理系

    参照