Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does C++ support member function references?

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 ]

like image 801
Lightness Races in Orbit Avatar asked Dec 14 '11 16:12

Lightness Races in Orbit


1 Answers

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

like image 60
Lightness Races in Orbit Avatar answered Sep 21 '22 05:09

Lightness Races in Orbit