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

履歴 編集

class template
<type_traits>

std::is_bounded_array(C++20)

namespace std {
  template <class T>
  struct is_bounded_array;

  template <class T>
  inline constexpr bool is_bounded_array_v = is_bounded_array<T>::value;
}

概要

Tが要素数の判明している配列型かを調べる。

要素数の判明している配列型とは、T[]を含まないT[N]形式の配列型である。

効果

is_bounded_arrayは、Tが要素型の判明している配列型であるならばtrue_typeから派生し、そうでなければfalse_typeから派生する。

#include <type_traits>

int main()
{
  static_assert(std::is_bounded_array<int[3]>::value);
  static_assert(std::is_bounded_array<int[]>::value == false);

  // CV修飾してもよい
  static_assert(std::is_bounded_array_v<const int[3]>);

  // 参照はダメ
  static_assert(std::is_bounded_array_v<int(&)[3]> == false);
}

出力

バージョン

言語

  • C++20

処理系

参照