I am trying to implement my own is_member_function_pointer
and I\'m having trouble with it.
namespace __implementation
{
// integral_constan
A very short talk on Chat has brought this easy solution:
// is_member_function_pointer
template struct is_member_function_pointer : public false_type {};
template struct is_member_function_pointer : public true_type {};
template struct is_member_function_pointer : public true_type {};
template struct is_member_function_pointer : public true_type {};
template struct is_member_function_pointer : public true_type {};
Which includes specializations for volatile
as well.
EDIT as @Xeo and @Johannes pointed out, I missed the ref-qualifier (aka rvalue for *this) versions:
template struct is_member_function_pointer : public true_type {};
template struct is_member_function_pointer : public true_type {};
template struct is_member_function_pointer : public true_type {};
template struct is_member_function_pointer : public true_type {};
template struct is_member_function_pointer : public true_type {};
template struct is_member_function_pointer : public true_type {};
template struct is_member_function_pointer : public true_type {};
template struct is_member_function_pointer : public true_type {};
template struct is_member_function_pointer : public true_type {};
template struct is_member_function_pointer : public true_type {};
template struct is_member_function_pointer : public true_type {};
template struct is_member_function_pointer : public true_type {};
template struct is_member_function_pointer : public true_type {};
template struct is_member_function_pointer : public true_type {};
template struct is_member_function_pointer : public true_type {};
template struct is_member_function_pointer : public true_type {};
template struct is_member_function_pointer : public true_type {};
template struct is_member_function_pointer : public true_type {};
template struct is_member_function_pointer : public true_type {};
template struct is_member_function_pointer : public true_type {};
Which is still quite doable. It's clearer then crazy template magic and numerous helper templates IMHO.
EDIT2 to clarify, the above are all in an implementation namespace and wrapped around by
template constexpr bool
is_member_function_pointer() { return __implementation::is_member_function_pointer>::result; }
Where remove_cv
is alias template'd to the convenient
template using
remove_cv = typename __implementation::remove_cv::type;
I suppose there are other, and maybe better ways, but this one is at least clear to the reader without any further SFINAE tricks like applied in libc++ or libstdc++, IMHO.