Something like this: template <typename T> inline wrap( const arma::subview_col<double>& x ){ return wrap( arma::Mat<T>( x ) ) ; }
(untested) This would still wrap it as a matrix though as this is what subview_col conceptually gives. The only downside is that this is somewhat inefficient as it would have to allocate memory for a arma::mat first and then copy that across to an Rcpp::Matrix … Romain > Le 3 déc. 2014 à 22:41, Martyn Plummer <plumm...@iarc.fr> a écrit : > > You just need to put a new template specialization of "wrap" for the > subview_col class in RcppArmadilloWrap.h based on the existing one for the > subview class. And throw in one for subview_row for good measure. > > Martyn > ________________________________________ > From: rcpp-devel-boun...@lists.r-forge.r-project.org > [rcpp-devel-boun...@lists.r-forge.r-project.org] on behalf of Dirk > Eddelbuettel [e...@debian.org] > Sent: 03 December 2014 19:25 > To: Romain Francois > Cc: rcpp-devel@lists.r-forge.r-project.org > Subject: Re: [Rcpp-devel] Returning an arma vec > > On 3 December 2014 at 18:30, Romain Francois wrote: > | > 2. If we replace the lines marked // x with > | > > | > return wrap(x.subvec(1, 2)); > | > > | > then it fails with a compiler error. > | > > | > error: cannot convert 'const arma::subview_col<double>' to 'SEXP' in > | > initialization > | > | This should be easy/trivial to fix for someone with the right skills. > > Sure. Maybe Gabor wants to give it a try. > > Dirk > > -- > http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org > _______________________________________________ > 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 > ----------------------------------------------------------------------- > This message and its attachments are strictly confidential. If you are > not the intended recipient of this message, please immediately notify > the sender and delete it. Since its integrity cannot be guaranteed, > its content cannot involve the sender's responsibility. Any misuse, > any disclosure or publication of its content, either whole or partial, > is prohibited, exception made of formally approved use > ----------------------------------------------------------------------- _______________________________________________ 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