I am trying to write an Rcpp function fun1 that can call another Rcpp function generically (let's say fun2). One possibility I could think about is to use an input argument that is a string containing the name of the function fun2.
 NumericVector fun1(NumericVector x, std::string name_of_fun2) { 
         
         NumericVector y = fun2(x);
         return(y);
}
I do not know how to fill in the missing code as I'm new to C++. One thing that I tried and that works is to use switch case statements, but the problem is that I need to define a big list of all possible functions fun2 that could be called in advance.
