is_compound クラス
指定された型が基本的であるテストします。
template<class Ty>
struct is_compound;
パラメーター
- Ty
問い合わせる型。
解説
型述語のインスタンスは is_fundamental<Ty> が true を保持する場合) Ty の型が基本型の場合 false を保持します (つまり; それ以外の場合は true を保持します。したがってが Ty が void に配列型関数型オブジェクトまたは関数ポインターまたは非静的クラス メンバーへの参照クラス共用体列挙型ポインターの場合またはこれらの 1 種類の cv-qualified フォームを保持 true。
使用例
// std_tr1__type_traits__is_compound.cpp
// compile with: /EHsc
#include <type_traits>
#include <iostream>
struct trivial
{
int val;
};
int main()
{
std::cout << "is_compound<trivial> == " << std::boolalpha
<< std::is_compound<trivial>::value << std::endl;
std::cout << "is_compound<int[]> == " << std::boolalpha
<< std::is_compound<int[]>::value << std::endl;
std::cout << "is_compound<int()> == " << std::boolalpha
<< std::is_compound<int()>::value << std::endl;
std::cout << "is_compound<int&> == " << std::boolalpha
<< std::is_compound<int&>::value << std::endl;
std::cout << "is_compound<void *> == " << std::boolalpha
<< std::is_compound<void *>::value << std::endl;
std::cout << "is_compound<int> == " << std::boolalpha
<< std::is_compound<int>::value << std::endl;
return (0);
}
必要条件
ヘッダー : <type_traits>
名前空間: std