On 11 February 2013 at 19:10, Yan Zhou wrote: | It seems to me that XPtr is like an ownership pointer. It is much like | unique_ptr. What you need here is a non-owning reference pointer, like | weak_ptr. | | Have you tried | | XPtr<A> A::getPtr(){ | return(XPtr<A>(this, false)); | } | | With the optional argument, a finalizer is not set and the gc will not delete | the C++ object. I haven't used XPtr in this way, but from the document I guess | this shall work.
Nice work. Should have thought of the finalizer -- on quick testing this does indeed do the trick. Well done. Dirk -- Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com _______________________________________________ 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