On 10 January 2019 at 00:23, Fellows, Ian wrote:
| My understanding is that afunc safe to use in a module. Is it also safe to 
call from other C++ code, or is lis open to garbage collection?

Every SEXP contains memory owned by R -- we create them that way and when we
return them to R they are indistinguishable. They really are R objects. [
Also note the caveat that SEXPs are just SEXPs -- no reference
counting. RObject is better, Rcpp::Shield<SEXP> is a more modern variant ]

Hence when you want to share in the C++ side, STL containers may be preferable.

Dirk

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org
_______________________________________________
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