On Mon, Dec 8, 2014 at 10:34 AM, Dirk Eddelbuettel wrote:
>
> On 8 December 2014 at 09:58, Tim Keitt wrote:
> |
> |
> | On Sun, Dec 7, 2014 at 4:52 AM, Dirk Eddelbuettel
> wrote:
> |
> |
> |
> | What you are after, if I understand it correctly, is (close to) a
> common
> | and
> | we
On 8 December 2014 at 09:58, Tim Keitt wrote:
|
|
| On Sun, Dec 7, 2014 at 4:52 AM, Dirk Eddelbuettel wrote:
|
|
|
| What you are after, if I understand it correctly, is (close to) a common
| and
| well studied idiom called 'RAII': Resource Acquisition is Initialization.
|
On Sun, Dec 7, 2014 at 4:52 AM, Dirk Eddelbuettel wrote:
>
>
> What you are after, if I understand it correctly, is (close to) a common
> and
> well studied idiom called 'RAII': Resource Acquisition is Initialization.
> Two
> quick links, and you will find many more:
>
>
I don't know if this exam
On 6 December 2014 at 21:41, Jeroen Ooms wrote:
| On Fri, Dec 5, 2014 at 12:54 AM, Romain François
| wrote:
| >
| > You are looking for XPtr.
|
| Thanks guys, exactly what I needed indeed. One follow-up question:
|
| Is there a way to use the XPtr object to prevent the c++ object it
| points to
On 5 December 2014 at 05:37, JJ Allaire wrote:
| I think the XPtr class is what you are looking for:
Indeed.
XPtr is perfect for managing external resources.
| http://www.r-bloggers.com/external-pointers-with-rcpp/
And there are four Rcpp Gallery posts highlighted as a result of a you search
On Fri, Dec 5, 2014 at 12:54 AM, Romain François
wrote:
>
> You are looking for XPtr.
Thanks guys, exactly what I needed indeed. One follow-up question:
Is there a way to use the XPtr object to prevent the c++ object it
points to from going out of scope? It seems like the c++ garbage
collector d
I think the XPtr class is what you are looking for:
http://www.r-bloggers.com/external-pointers-with-rcpp/
On Fri, Dec 5, 2014 at 2:45 AM, Jeroen Ooms wrote:
> Does Rcpp provide some elegant way to let the R user manage persistent
> c++ objects that have no R type (e.g. internal handles or sess
You are looking for XPtr.
https://github.com/RcppCore/Rcpp/blob/master/inst/include/Rcpp/XPtr.h
It is a template class whose first parameter is the class of the raw pointer
you are dealing with, let’s call it T.
You can create an external pointer using something like :
XPtr xp( new T(...) )
Does Rcpp provide some elegant way to let the R user manage persistent
c++ objects that have no R type (e.g. internal handles or sessions of
some sort)?
In C, I would use R_MakeExternalPtr to create a ptr SEXP that the user
can pass from one R function to another. This also makes it easy to
add a