Take the tour ×  Basically, I would like to be able to be able
to pass a function_A with any parameter to T_function, so that
T_function could execute some commands, then call the passed-in
function  This is what I came up with (which might make my goal
more clear) :  template <typename t_return, typename t_param>
void foo(t_return (*func)(t_param), t_param p)     //do code
foo<void, int>(&someFunc, someInt);  The above code works great,
but it seems bothersome. I'm also not sure how fool-proof it is.
Does anyone with a little more understanding have an
improvement? I've tried looking this up online, however it has
proved difficult to search for.  share|improve this question add
comment  1 Answer  up vote 4 down vote accepted  You could just
make the whole function type a template parameter. Then the
compiler can deduce the template parameters using the input
arguments.  template <typename F, typename T> void foo (F func,
const T& p)     // do code  foo(&someFunc, someInt);  This also
has an advantage that f