首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::is_member_function_pointer

Defined in header <type_traits>

?

?

template< class T > struct is_member_function_pointer;

?

(since C++11)

检查是否T是一个非静态成员函数指针。提供成员常量。value等于true,如果T是非静态成员函数指针类型。否则,value等于false...

模板参数

T

-

a type to check

辅助变量模板

template< class T > inline constexpr bool is_member_function_pointer_v = is_member_function_pointer<T>::value;

?

(since C++17)

继承自STD:积分[医]常量

成员常数

value static

true if T is a member function pointer type , false otherwise (public static member constant)

成员函数

operator bool

converts the object to bool, returns value (public member function)

operator() (C++14)

returns value (public member function)

成员类型

Type

Definition

value_type

bool

type

std::integral_constant<bool, value>

可能的实施

模板<class T>结构是[医]成员[医]功能[医]指针[医]助手:std::false[医]类型{};模板<类T,类U>结构是[医]成员[医]功能[医]指针[医]助手<T U::%2A>:STD::IS[医]功能<T>模板<class T>结构是[医]成员[医]功能[医]指针:是[医]成员[医]功能[医]指针[医]助手<std::删除[医]CV[医]T型<T>>{};

*。

二次

代码语言:javascript
复制
#include <type_traits>
 
class A {
public:
    void member() { }
};
 
int main()
{
    // fails at compile time if A::member is a data member and not a function
    static_assert(std::is_member_function_pointer<decltype(&A::member)>::value,
                  "A::member is not a member function."); 
}

二次

另见

is_pointer (C++11)

checks if a type is a pointer type (class template)

is_member_object_pointer (C++11)

checks if a type is a pointer to a non-static member object (class template)

is_member_pointer (C++11)

checks if a type is a pointer to a non-static member function or object (class template)

代码语言:txt
复制
 ? cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com