[Rcpp-devel] Creating an R interface to non-copyable C++ class

2018-04-11 Thread Cris Luengo
I have some functionality in C++ that I need to access from R. My impression was that Rcpp was the simplest way to accomplish this, but I haven't been able to make it work yet. The core problem, I think, is that data created is not copyable. One of these functions returns a `std::unique_ptr` ownin

Re: [Rcpp-devel] Creating an R interface to non-copyable C++ class

2018-04-11 Thread Cris Luengo
> On Apr 11, 2018, at 19:14, Dirk Eddelbuettel wrote: > > On 11 April 2018 at 17:19, Cris Luengo wrote: > | Ideally, an R variable would hold on to this pointer (with or without the > | `std::unique_ptr` around it), and delete the object when it is cleared (or > | garbage coll

Re: [Rcpp-devel] Creating an R interface to non-copyable C++ class

2018-04-12 Thread Cris Luengo
delbuettel wrote: > > On 11 April 2018 at 23:54, Cris Luengo wrote: > | > The way R thinks about this is that _it_ owns everything, and Rcpp > makes > | > getting things back and forth _using the R memory system and its > lifetime / > | > reference count control_ fairly