is_member_function_pointer Class
,如果类型是指向成员函数,测试。
template<class Ty>
struct is_member_function_pointer;
- Ty
查询的类型。
该类型特性的实例适合,如果类型 Ty 是指向成员函数或 cv-qualified 指针指向成员函数,否则它包含错误。
// std_tr1__type_traits__is_member_function_pointer.cpp
// compile with: /EHsc
#include <type_traits>
#include <iostream>
struct trivial
{
int val;
};
struct functional
{
int f();
};
int main()
{
std::cout << "is_member_function_pointer<trivial *> == "
<< std::boolalpha
<< std::is_member_function_pointer<trivial *>::value
<< std::endl;
std::cout << "is_member_function_pointer<int trivial::*> == "
<< std::boolalpha
<< std::is_member_function_pointer<int trivial::*>::value
<< std::endl;
std::cout << "is_member_function_pointer<int (functional::*)()> == "
<< std::boolalpha
<< std::is_member_function_pointer<int (functional::*)()>::value
<< std::endl;
return (0);
}
**标题:**type_traits
命名空间: std