[Rcpp-devel] shallow/deep copy
yuanzygoso at gmail.com
Wed Aug 31 17:59:39 CEST 2011
Thanks for the reply, Xian.
The quick reference is quite helpful. Most of the time, I use 'inline' to
create R functions and I think 'inline' includes Rcpp.h which specifies the
Very often I will need Armadillo and will be "using namespace arma;". Maybe
I should keep using arma:: too, according to Darren's advice.
On Wed, Aug 31, 2011 at 6:05 AM, Christian Gunning <xian at unm.edu> wrote:
> On Wed, Aug 31, 2011 at 3:00 AM,
> <rcpp-devel-request at r-forge.wu-wien.ac.at> wrote:
> > Rcpp::NumericVector x = as<Rcpp::NumericVector>(x_);
> > std::vector<double> x = as< std::vector<double> >(x_);
> Nice clarification of what's going on under the hood, Darren.
> For the first case, the above is synonymous with:
> Rcpp::NumericVector x(x_);
> If you want a deep copy, you can use:
> Rcpp::NumericVector x(clone(x_));
> See the quickref pdf for examples
> there, "using namespace Rcpp;" is implied throughout unless otherwise
> A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal – Panama!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Rcpp-devel