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

履歴 編集

function
<mdspan>

std::mdspan::static_extent(C++23)

static constexpr size_t static_extent(rank_type r) noexcept;

概要

指定次元の静的要素数を取得する。

戻り値

extents_type::static_extent(r)

例外

投げない

#include <cassert>
#include <mdspan>

int main()
{
  int arr[] = {1, 2, 3, 4, 5, 6};
  // 動的要素数 2x3 の2次元配列ビュー
  std::mdspan<int, std::dextents<size_t, 2>> mat{arr, 2, 3};

  static_assert(mat.static_extent(1) == std::dynamic_extent);
  assert(mat.extent(1) == 3);
}

出力

バージョン

言語

  • C++23

処理系

関連項目

参照