#include int func(int x, int y) { return x+y; } int main() { typedef std::function Funcp; Funcp funcp = func;
As Erik points out, this is not possible directly. To achieve the effect you probably desire, you would have to make the code that uses the pointer a template.