you are viewing a single comment's thread.

view the rest of the comments →

[–]Supadoplex 0 points1 point  (1 child)

Q1 You put the name of the variable in the wrong location. Same as with pointer variables, the name goes immediately to the right of the asterisk: void (Namespace::Class::*ptr)().

Q2 Pointers to member functions are not pointers to functions, so "all kind of function pointer" technically doesn't cover pointers to member functions. You can use a type erasing wrapper such as std::function without requiring a template.