[Rcpp-devel] about the RcppSexp (Rcpp::RObject) constructors

Romain François francoisromain at free.fr
Thu Dec 31 16:52:32 CET 2009


Hi,

Now that I am on the road for class inheritance and all that, I am not 
sure anymore that the myriad of constructors for Rcpp::RObject are a 
good idea, i.e since we have for example :

Rcpp::RObject( double& d ) ;

it is then valid (as far as my -- still learning -- understanding of C++ 
goes) to do this :

Rcpp::Environment( 1.3 )

which of course is a nuisance.

I was thinking of replacing the constructors with a set of functions 
(and C++ polymorphism makes it easy I think), so we would have a 
function (let's decide about its name first) for example wrap and many 
overloaded with different parameters.

Rcpp::wrap( const double& d)
Rcpp::wrap( const std::vector<int>& d)
...

then the wrap can dispatch to the appropriate class.

Romain

-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/IW9B : C++ exceptions at the R level
|- http://tr.im/IlMh : CPP package: exposing C++ objects
`- http://tr.im/HlX9 : new package : bibtex





More information about the Rcpp-devel mailing list