The following code:
struct X { void f() {} void g() { auto h = &f; } };
leads to:
error: ISO C++ forbids taking the address of an unqualified or parenthesized non-static member function to form a pointer to member function. Say '&X::f'
My question is: why is it prohibited and prohibited by the standard? It would be more convenient if the user referred to him as unskilled, so I assume that there is some other justification (security? Uncertainty? Ease of compiler implementation?) For the requirement?
Andrew Tomazos
source share