Gregory Jefferis

On 10 Sep 2014, at 10:39, Romain Francois <rom...@r-enthusiasts.com> wrote:

> RCPP_EXPOSED_CLASS(A)
> 
> before you declare class A and simply use this signature for the method. 
> 
> void DoSomethingWithInstanceOfA(const A& )


I used this approach happily in the nabor package (on github) but the only 
caveat is that from R you need to call with something like:

A$method(B$.CppObject)

You can get some interesting crashes if you pass the R reference class (i.e. B) 
directly as the argument. I guess it might be better to have a derived R class 
that looks after extracting the .CppObject field. 

Best,

Greg. 
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to