is_reference クラス
型が参照であるかどうかをテストします。
template<class Ty>
struct is_reference;
パラメーター
- Ty
問い合わせる型。
解説
型 Ty がオブジェクトへの参照または関数への参照である場合、型述語のインスタンスは true を保持します。それ以外の場合は、false を保持します。
使用例
// std_tr1__type_traits__is_reference.cpp
// compile with: /EHsc
#include <type_traits>
#include <iostream>
struct trivial
{
int val;
};
int main()
{
std::cout << "is_reference<trivial> == " << std::boolalpha
<< std::tr1::is_reference<trivial>::value << std::endl;
std::cout << "is_reference<trivial&> == " << std::boolalpha
<< std::tr1::is_reference<trivial&>::value << std::endl;
std::cout << "is_reference<int()> == " << std::boolalpha
<< std::tr1::is_reference<int()>::value << std::endl;
std::cout << "is_reference<int(&)()> == " << std::boolalpha
<< std::tr1::is_reference<int(&)()>::value << std::endl;
return (0);
}
必要条件
ヘッダー : <type_traits>
名前空間: std