std::is_unbounded_array
From cppreference.com
| ヘッダ <type_traits> で定義 |
||
| template< class T > struct is_unbounded_array; |
(C++20以降) | |
std::is_unbounded_arrayはUnaryTypeTraitです。
Tが不明な境界の配列であるかをチェックします。Tが不明な境界の配列型である場合、valueはtrueに等しいメンバ定数を提供します。それ以外の場合、valueはfalseに等しくなります。
プログラムがstd::is_unbounded_arrayまたはstd::is_unbounded_array_vに特殊化を追加した場合、その動作は未定義です。
目次 |
[編集] テンプレートパラメータ
| T | - | チェックする型 |
[編集] ヘルパー変数テンプレート
| template< class T > constexpr bool is_unbounded_array_v = is_unbounded_array<T>::value; |
(C++20以降) | |
std::integral_constant から継承
メンバ定数
| value [static] |
Tが不明な境界の配列型である場合はtrue、それ以外の場合はfalse(公開静的メンバ定数) |
メンバ関数
| operator bool |
オブジェクトを bool に変換し、value を返します。 (public member function) |
| operator() (C++14) |
value を返します。 (public member function) |
メンバ型
| 型 | 定義 |
value_type
|
bool |
type
|
std::integral_constant<bool, value> |
[編集] 考えられる実装
template<class T> struct is_unbounded_array: std::false_type {}; template<class T> struct is_unbounded_array<T[]> : std::true_type {}; |
[編集] 注釈
| 機能テストマクロ | 値 | 規格 | 機能 |
|---|---|---|---|
__cpp_lib_bounded_array_traits |
201902L |
(C++20) | std::is_bounded_array、std::is_unbounded_array |
[編集] 例
このコードを実行
#include <type_traits> class A {}; static_assert ("" && std::is_unbounded_array_v<A> == false && std::is_unbounded_array_v<A[]> == true && std::is_unbounded_array_v<A[3]> == false && std::is_unbounded_array_v<float> == false && std::is_unbounded_array_v<int> == false && std::is_unbounded_array_v<int[]> == true && std::is_unbounded_array_v<int[3]> == false ); int main() {}
[編集] 関連項目
| (C++11) |
型が配列型であるかをチェックする (クラステンプレート) |
| (C++20) |
型が既知の境界を持つ配列型であるかをチェックする (クラステンプレート) |
| (C++11) |
指定された次元に沿った配列型のサイズを取得する (クラステンプレート) |