I don't want function pointer overhead, I just want the same code for two different functions with the same signature:
void f(int x);
void g(int x);
...
template<typename F>
void do_work()
{
int v = calculate();
F(v);
}
...
do_work<f>();
do_work<g>();
Is this possible?
To clear up possible confusion: With "template parameter" I mean the parameter/argument to the template and not a function parameter whose type is templated.