I am exposing a c++ class using Rcpp. It works fantastic, but my problem is
how to implement a method which has default params. I have the class:

class myClass {

    public:

        int myMethod(int param1, int param2 = 0);
}

and I config the module:

RCPP_MODULE(mymodule) {
    class_<myClass>("myClass")
        .constructor()
        .method("myMethod", &myClass::myMethod)
;
}

When I try to execute the function in R passing only the mandatory param I
get an error because R does not recognize the function, but if I execute it
with both params, it works great. So, how can I define the method in order
to be able to execute it without informing the optional params?

Thank you,

Sergio
_______________________________________________
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

Reply via email to