[Rcpp-devel] inline with classes
Whit Armstrong
armstrong.whit at gmail.com
Tue Oct 5 19:21:53 CEST 2010
aha, thanks for correcting me. on the inline/Rcpp division of labor.
So, what you are suggesting should have been obvious to me.
I pass the class def in the include statement of the inline function?
Is that it?
I'll ping back after I try this.
If this really works, then I think WinBUGS can finally die.
-Whit
2010/10/5 Dirk Eddelbuettel <edd at debian.org>:
>
> 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