Skip to content
Prev 3938 / 10988 Next

[Rcpp-devel] Persistent C++ objects within R/Rcpp?

On 06/26/2012 02:00 AM, Dirk Eddelbuettel wrote:
Andy,

I second Dirk's answer, with the following addition. My 
"simulation object" (SO) was a bit big, and I was loosing a lot of 
time to copy operations (not sure if this is Rcpp's fault or my 
lack of coding skill). My solution was to use classes. I code, in 
C++, my SO as a class. I use the Rcpp class interface to write R 
wrappers to the functions which manipulate the state of the SO.

To run a simulation, I load the module into R, create an instance 
of the class, then run the simulation via the R functions which 
are linked to the SO functions.

I am sure there is a more elegant way, but this approach works.

+glenn