std::is_member_object_pointer
STD::是[医]成员[医]对象[医]指针
Defined in header | | |
---|---|---|
template< class T > struct is_member_object_pointer; | | (since C++11) |
检查是否T
是非静态成员对象。提供成员常量。value
等于true
,如果T
是非静态成员对象类型。否则,value
等于false
...
模板参数
T | - | a type to check |
---|
辅助变量模板
template< class T > inline constexpr bool is_member_object_pointer_v = is_member_object_pointer | | (since C++17) |
---|
继承自STD:积分[医]常量
成员常数
value static | true if T is a pointer to member object , 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::整数[医]常数<bool,std::is[医]成员[医]指针<T>*价值&%21 std::is[医]成员[医]功能[医]指针<T>*价值>{};
*。
例
二次
#include <iostream>
#include <type_traits>
int main() {
class cls {};
std::cout << (std::is_member_object_pointer<int(cls::*)>::value
? "T is member object pointer"
: "T is not a member object pointer") << '\n';
std::cout << (std::is_member_object_pointer<int(cls::*)()>::value
? "T is member object pointer"
: "T is not a member object pointer") << '\n';
}
二次
产出:
二次
T is member object pointer
T is not a member object pointer
二次
另见
is_pointer (C++11) | checks if a type is a pointer type (class template) |
---|---|
is_member_pointer (C++11) | checks if a type is a pointer to a non-static member function or object (class template) |
is_member_function_pointer (C++11) | checks if a type is a pointer to a non-static member function (class template) |
© cppreference.com
在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。