How do I create a metafunction that takes any kind of function pointer? In the code below, how do I get rid of \"decltype(&f)\" ?
template
Right now there is unfortunately no good way of doing this.
The standard committee has, however, accepted a proposal that makes this valid code:
template <auto functionPointer>
void runFunc() {
functionPointer();
}
Compiler support should be coming soon.
You can use this:
template <typename FuncType>
void runFunc(FuncType functionPointer )
{
functionPointer();
}
runFunc(f);