C++: pass function with arbitrary number of parameters as a parameter
long time browser, first time asker here. I've written a number of scripts for doing various 1D numerical integration methods and compiled them into a library. I would like that library to be as flexible as possible regarding what it is capable of integrating. Here I include an example: a very simple trapezoidal rule example where I pass a pointer to the function to be integrated. // Numerically integrate (*f) from a to b // using the trapezoidal rule. double trap(double (*f)(double), double a, double b) { int N = 10000; double step = (b-a)/N; double s = 0; for (int i=0; i<=N; i++) { double xi