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

履歴 編集

class template
<type_traits>

std::is_unbounded_array(C++20)

namespace std {
  template <class T>
  struct is_unbounded_array;

  template <class T>
  inline constexpr bool is_unbounded_array_v = is_unbounded_array<T>::value;
}

概要

Tが要素数の不明な配列型かを調べる。

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

効果

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

#include <type_traits>

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

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

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

出力

バージョン

言語

  • C++20

処理系

参照