how do I write a function pointer as default template argument, I'am guessing to write it like this:
template<typename R,
typename A,
typename F=R (*PF)(A)>
class FunctionPtr { ...
my question is,
1.is it possible?
2.if it is and my guess code above is correct, what the purpose of PF
here? do I need this?
No, you don't need PF.
template<typename R,
typename A,
typename F=R (*)(A)>
The PF
not only is useless but must be removed in this context. It would, for example, be necessary in the context of a function pointer declaration :
int (*PF)(double) = &A::foo; // declares a 'PF' variable of type 'int (*)(double)'
but it is neither required nor legal here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With