[Rcpp-devel] Exposing constructors with same number of arguments with different types using Rcpp Modules
Excellent, thanks for the update. Jelmer
On Sat, May 14, 2011 at 17:20, Dirk Eddelbuettel <edd at debian.org> wrote:
On 13 May 2011 at 11:58, Dirk Eddelbuettel wrote: | On 13 May 2011 at 16:35, Jelmer Ypma wrote: | | Dear Rcpp-list, | | | | I'm trying to expose multiple constructors of a C++ class to R using | | modules. Here is an example of what I want to do based on the Uniform | | example [...] | | Compilation works fine (on Windows using RTools, Rcpp_0.9.4.1, | | inline_0.3.8), but the R code cannot distinguish between two | | constructors with the same number of arguments, but with different | | types for the arguments and always calls Uniform(double, double). The | | If I recall correctly, we have determined that this cannot work. It is one of | these 'obvious in hindsight' issue. ?Recall that R does the dispatch, and R | cannot differentiate between ?foo(double) and ?foo(int) ?as it is not typed. | | So I think you will have to differentiate the constructors by name. Sorry | about that, but even Rcpp modules has its limits. | | And I may of course be wrong too in which case Romain may come in and | clarify. I got a brief word in with Romain who clarified that this ought to be possible but may not be right now. ?So stay tuned -- with some luck Romain may be able to improve on what we currently have. In the meantime you may have to make do with different setter functions. Dirk -- Gauss once played himself in a zero-sum game and won $50. ? ? ? ? ? ? ? ? ? ? ?-- #11 at http://www.gaussfacts.com