template types in std is_member_function_pointer

Viewed 305

I am referring to a possible implementation of std::is_member_function_pointer here.

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< std::remove_cv_t<T> >     


#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."); 
}

I know that

"dectype(&A::member)"

will be

"void (A::*)()"

But I dont understand what type T and type U map to in "void (A::*)()"?

3 Answers
Related