Rcpp modules more flexible
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Rcpp modules just got more flexible (as of revision 3838 of Rcpp, to become 0.9.16 in the future).
modules have allowed exposing C++ classes for some time now, but developpers had to declare custom wrap and as specializations if they wanted their classes to be used as return type or argument type of a C++ function or method. This led to writing boilerplate code. The newest devel version allows for syntax like this:
The only thing the developper has to do is to declare the class using the macro RCPP_EXPOSED_CLASS. This will declare the appropriate class traits that Rcpp is using for internal implementations of as and wrap
One the example we can see three examples of the new functionality:
- make_foo : this returns a Foo
- cloner: this returns a Foo*
- bla: uses a const Foo& as argument
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.