Hi all, I am calling from R (say funcR) a c++ function (say funcCpp) which needs either some programmer-defined c++ class (say programmerClassCpp1, 2, etc...) or a user-defined c++ class (say userClassCpp). Here is an illustration of what I am doing:
funcR(..., class="ClassCpp"){ # do something and then call the c++ function funcCpp(class); } funcCpp(std::string classCpp){ switch(classCpp){ case "class1" : point to the programmer defined c++ class programmerClassCpp1; break; case "class2" : point to the programmer defined c++ class programmerClassCpp2; break; case "new": point to the user defined c++ class userClassCpp; break; default : Rcpp::stop("not supported class"); }; } This post http://gallery.rcpp.org/articles/passing-cpp-function-pointers/ reflects what I need for a function and I am wondering whether it is possible to do this for a class. The obvious solution is to replicate manually what has been done in the post to each method of the class (for instance, work on a vector of functors to the class methods), but I don't see it as the optimal solution. Many thanks for any hint, Yousra
_______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel