Does C++ support member function references?

故事扮演 提交于 2019-12-21 09:39:14

问题


C++ permits function pointers and function references. It also permits pointers-to-member-functions.

But does it permit references-to-member-functions?

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 ]


回答1:


[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 ]



来源:https://stackoverflow.com/questions/8508266/does-c-support-member-function-references

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!