Question 10: Higher order functions and templated function pointers [6]

The C++ templated function pointers below can be regarded as providing a limited emulation of higher order functions.

(i) Discuss how this emulation works.

(ii) Discuss the limitations of this emulation.
#include 

// apply f to arguments x and y, return the result
template 
T1 funcall(T1 (*f)(T2,T3), T2 x, T3 y) {
   return (*f)(x, y);
}

int prod(int x, int y) { return x * y; }
double power(float f, int i) { return pow(f, i); }

int main()
{

   int x = 3; int y = 5;
   printf("prod(%d,%d) = %d\n", x, y, funcall(prod, x, y));
   float f = 3.5; int i = 2;
   printf("power(%g, %d) = %g\n", f, i, funcall(power, f, i));
   return 0;
}