C++ 为什么在'std::is_member_function_pointer'中使用与符号?

C++ 为什么在'std::is_member_function_pointer'中使用与符号?,c++,c++11,methods,member,typetraits,C++,C++11,Methods,Member,Typetraits,使用std::is_member_function_pointer的示例使用了一个符号and,我在理解语法时遇到了一些困难 #include <type_traits> class A { void member_function() { } }; int main() { // fails at compile time if A does not contain member_function as a function. static_assert(

使用std::is_member_function_pointer的示例使用了一个符号and,我在理解语法时遇到了一些困难

#include <type_traits>

class A {
    void member_function() { }
};

int main()
{
    // fails at compile time if A does not contain member_function as a function.
    static_assert(std::is_member_function_pointer<decltype(&A::member_function)>::value,
                  "Class does not contain member."); 
}
#包括
甲级{
无效成员_函数(){}
};
int main()
{
//如果未将成员函数作为函数包含,则在编译时失败。
静态断言(std::is_成员_函数_指针::值,
“类不包含成员。”);
}

&A::member\u函数
的含义是什么?A::member\u函数是否有含义(如果有,区别是什么)

此外,
std::成员函数指针是否与函数模板一起工作?

此表达式

&A::member_function

字面意思是成员函数指针。&用于获取指向成员函数的指针。

a::member\u函数本身在表达式中没有意义。形成指向成员的指针的唯一方法是
&ClassName::MemberName
std::is_member\u function\u指针是否与函数模板一起工作?
我不确定我是否理解这个问题<代码>标准::is_成员_函数_指针
将类型作为其模板参数。函数模板不是一种类型。还要注意的是,这种使用
static\u assert
是毫无意义的。如果
A
实际上不包含名为
member\u function
的成员,则该行代码的格式不正确,编译器将发出语法错误,而不是
static\u assert
中指定的错误消息。如果
member\u函数
实际上是一个数据成员,我想它会做一些有用的事情。@IgorTandetnik你说得对,我对这个例子做了一点修改。&a::member\u函数意味着你将引用作为参数传递,而::member\u函数意味着你将值作为参数传递。迂腐地说,它只是指向member的指针。它是否是函数成员是次要的,实际上是OP测试目的的一部分。