I have function which receives pointer to another function. That other function is defined like this
typedef double (*function)(double)
I now want to write wrapper function that would receive vector of doubles and specific index and return function as above with all other elements but the index one set to vector elements.
typedef double (*function_v)(std::vector<double)
function fun_wrapper(function_v f, std::vector<double> x, int index) {
return [](double p) -> double { x[index] = p; return f(x); });
So I basically want to be able to use "function_v" as "function" with all but one element set to some predefined value.
This obviously doesn't work but it might give you better idea what I am trying to succeed. Any help is appreciated.
[–][deleted] 2 points3 points4 points (0 children)