Re: [Rcpp-devel] Rcpp and ExternalPtr

2014-12-05 Thread Romain François
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(...) )

Re: [Rcpp-devel] Rcpp and ExternalPtr

2014-12-05 Thread JJ Allaire
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

Re: [Rcpp-devel] Returning an arma vec

2014-12-05 Thread Serguei Sokol
Le 04/12/2014 17:57, Romain François a écrit : Something like this: template inline wrap( const arma::subview_col& x ){ return wrap( arma::Mat( x ) ) ; } Interesting. If I do inline SEXP wrap( const arma::vec& x ) { return wrap(Rcpp::NumericVector( x.begin(), x.end())); } then wrap(

Re: [Rcpp-devel] Returning an arma vec

2014-12-05 Thread Martyn Plummer
I had something simpler in mind. I'll send a pull request when I've finished testing (This package has many dependencies!) Martyn On Thu, 2014-12-04 at 17:57 +0100, Romain François wrote: > Something like this: > > template > inline wrap( const arma::subview_col& x ){ > return wrap( arma::