Type traits | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Compile-time rational arithmetic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Compile-time integer sequences | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(C++14) |
Defined in header <type_traits> | ||
template<class T> struct is_member_function_pointer; | (since C++11) | |
std::is_member_function_pointer
is aUnaryTypeTrait.
Checks whetherT
is a non-static member function pointer. Provides the member constantvalue
which is equal totrue, ifT
is a non-static member function pointer type. Otherwise,value
is equal tofalse.
If the program adds specializations forstd::is_member_function_pointer
orstd::is_member_function_pointer_v
, the behavior is undefined.
Contents |
T | - | a type to check |
template<class T> constexprbool is_member_function_pointer_v= | (since C++17) | |
value [static] | true ifT is a member function pointer type,false otherwise(public static member constant) |
operator bool | converts the object tobool, returnsvalue (public member function) |
operator() (C++14) | returnsvalue (public member function) |
Type | Definition |
value_type | bool |
type | std::integral_constant<bool, value> |
template<class T>struct is_member_function_pointer_helper:std::false_type{}; template<class T,class U>struct is_member_function_pointer_helper<T U::*>:std::is_function<T>{}; template<class T>struct is_member_function_pointer: is_member_function_pointer_helper<typenamestd::remove_cv<T>::type>{}; |
#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.");}
(C++11) | checks if a type is a pointer type (class template)[edit] |
(C++11) | checks if a type is a non-static member object pointer (class template)[edit] |
(C++11) | checks if a type is a pointer to a non-static member function or object (class template)[edit] |