[Rcpp-devel] Create an instance of a reference class for a C++ class exported as a module from within C++?

romain at r-enthusiasts.com romain at r-enthusiasts.com
Fri Jun 3 10:09:50 CEST 2011

This is something we have to add at some point. 

At the moment the only way i see is to make an R call to "new" and construct the object this way...

Le 2 juin 2011 à 21:31, Douglas Bates <bates at stat.wisc.edu> a écrit :

> Sorry for the long subject line but I hope it describes what I want to
> do.  I have a C++ class, dgTMatrix, that is exported in a module
> definition.
> ...
>    class_<dgCMatrix>("dgCMatrix")
>    ...
>    ;
> }
> Many of the methods for this class return other members of this class.
> Can I create a new instance of the reference class in R from within
> the module?  I'm sure it is possible, I'm just wondering if there is
> an easy way to do this without duplicating large chunks of the code in
> Rcpp/src/Module.cpp.  Can i somehow clone the SEXP representing the
> current instance then swap the external pointer to the C++ object?
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

More information about the Rcpp-devel mailing list