std::is_unbounded_array
提供: cppreference.com
ヘッダ <type_traits> で定義 | ||
template<class T > struct is_unbounded_array; | (C++20以上) | |
T
が境界の未知な配列型かどうか調べます。 T
が境界の未知な配列型であれば、 true に等しいメンバ定数 value
が提供されます。 そうでなければ、 value
は false に等しくなります。
is_unbounded_array
または is_unbounded_array_v
に対して特殊化を追加するプログラムは未定義です。
目次 |
[編集]テンプレート引数
T | - | 調べる型 |
[編集] ヘルパー変数テンプレート
template<class T > inlineconstexprbool is_unbounded_array_v = is_unbounded_array<T>::value; | (C++20以上) | |
std::integral_constant から継承
メンバ定数
value [静的] | T が境界の未知な配列型であるならば true、そうでなければ false(パブリック静的メンバ定数) |
メンバ関数
operator bool | オブジェクトを bool に変換します。 value を返します (パブリックメンバ関数) |
operator() (C++14) | value を返します (パブリックメンバ関数) |
メンバ型
型 | 定義 |
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{}; |
[編集]例
Run this code
#include <iostream>#include <type_traits> class A {}; int main(){std::cout<<std::boolalpha;std::cout<< std::is_unbounded_array_v<A><<'\n';std::cout<< std::is_unbounded_array_v<A[]><<'\n';std::cout<< std::is_unbounded_array_v<A[3]><<'\n';std::cout<< std::is_unbounded_array_v<float><<'\n';std::cout<< std::is_unbounded_array_v<int><<'\n';std::cout<< std::is_unbounded_array_v<int[]><<'\n';std::cout<< std::is_unbounded_array_v<int[3]><<'\n';}
出力:
false true false false false true false
[編集]関連項目
(C++11) | 型が配列型かどうか調べます (クラステンプレート) |
(C++20) | 型が境界の既知な配列型かどうか調べます (クラステンプレート) |
(C++11) | 配列型の指定された次元のサイズを取得します (クラステンプレート) |