[Rcpp-devel] inline with classes

Dirk Eddelbuettel edd at debian.org
Tue Oct 5 18:35:47 CEST 2010


Hi Whit,

On 5 October 2010 at 12:25, Whit Armstrong wrote:
| I just reviewed the Rcpp documentation.

Great. Now tell us how to make it sticky so that we get you to contribute :)
 
| I see plenty of cfunction/cxxfunction examples, but I'm curious
| whether one can provide a class definition inline in an R script and
| then initialize an instance of the class and call a method on the
| class.  all inline in R.
| 
| Is this feature something you all would consider adding to Rcpp?

a) A change would be an inline feature, not an Rcpp feature.

b) But we already do :) support this, and even use it in numerous cases in
   the unit tests; this uses the   include=   argument to cxxfunction et al.

So you can supply your templated logic in an R string to include= and then
use the code in an R string to to src= and pass it all through cxxfunction()
for a quick test.

See e.g. runit.macros.R or or runit.Module.R.  I think we also have blog
posts and / or vignette examples that use it.

Hth, Dirk

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com


More information about the Rcpp-devel mailing list