auto p1 = &f;
The first is more or less correct. But since non-member functions have implicit conversions to pointers, & not required. C ++ does this conversion, the same applies to static member functions.
For a quote from cppreference :
A value of a function of type T can be implicitly converted to a prvalue pointer to this function. This does not apply to a non-static member of a function, since lvalues ββthat reference non-static member functions do not exist.
source share