is_member_object_pointer Class
The latest version of this topic can be found at is_member_object_pointer Class.
Tests if type is a pointer to member object.
Syntax
template <class Ty>
struct is_member_object_pointer;
Parameters
Ty
The type to query.
Remarks
An instance of the type predicate holds true if the type Ty
is a pointer to member object or a cv-qualified
pointer to member object, otherwise it holds false. Note that is_member_object_pointer
holds false if Ty
is a pointer to member function.
Example
// std_tr1__type_traits__is_member_object_pointer.cpp
// compile with: /EHsc
#include <type_traits>
#include <iostream>
struct trivial
{
int val;
};
struct functional
{
int f();
};
int main()
{
std::cout << "is_member_object_pointer<trivial *> == "
<< std::boolalpha
<< std::is_member_object_pointer<trivial *>::value
<< std::endl;
std::cout << "is_member_object_pointer<int trivial::*> == "
<< std::boolalpha
<< std::is_member_object_pointer<int trivial::*>::value
<< std::endl;
std::cout << "is_member_object_pointer<int (functional::*)()> == "
<< std::boolalpha
<< std::is_member_object_pointer<int (functional::*)()>::value
<< std::endl;
return (0);
}
is_member_object_pointer<trivial *> == false
is_member_object_pointer<int trivial::*> == true
is_member_object_pointer<int (functional::*)()> == false
Requirements
Header: <type_traits>
Namespace: std