C ++是否支持成员函数引用? [英] Does C++ support member function references?
问题描述
C ++允许函数指针和 函数引用 .它还允许指向成员的指针功能.
但是它允许引用成员功能吗??
我似乎无法从标准中推断出规则,而且我无法使程序与它们配合使用.
I can't seem to deduce the rules from the standard, and I've failed to make a program work with them.
[成员函数指针] [
[ member function pointers ] [ member function references ]
推荐答案
[C++11: 8.3.3/3]:
指向成员的指针不得指向静态 类(9.4)的成员,具有引用类型的成员或" cv 无效". [ 注意:另请参阅5.3和5.5. 指向成员的指针"类型是不同的 从指针"类型开始,也就是说,仅声明指向成员的指针 指向成员声明符语法的指针,而不是指针 声明符语法. 在C ++中没有引用成员"类型. -结束 注意]
[C++11: 8.3.3/3]:
A pointer to member shall not point to a static member of a class (9.4), a member with reference type, or "cv void." [ Note: See also 5.3 and 5.5. The type "pointer to member" is distinct from the type "pointer", that is, a pointer to member is declared only by the pointer to member declarator syntax, and never by the pointer declarator syntax. There is no "reference-to-member" type in C++. —end note ]
这篇关于C ++是否支持成员函数引用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!