Skip to content
Prev 2671 / 10988 Next

[Rcpp-devel] Pointer troubles

Hi!

Reading this thread, I hit on some questions which would help me understand Rcpp a lot better.
Hmm, I understand that XPtr is always a "strong" pointer in the sense that XPtr will delete the object once it gets out of scope. Is that right? If so, how can I get a weak pointer? I.e. tell XPtr to never call a finalizer at all since the ownership is handled at a different spot in my code.

Moreover, I saw that basically the whole class_-declaration mechanism boils down to stuff things into XPtr, right? So on the C++ side one has actually pointers to wrapped classes which are held by XPtr. How can I now obtain these pointers and what is the type of the wrapped classes? The problem is that I have to deal with a wrapped class A, but might also fool around with A* in my code...

Cheers,

Sebastian