Thanks Doug,

I made an example illustrating this for the Rcpp gallery - AND I forgot to 
acknowledge you in the example. That was a mistake - sorry!

Regards
Søren

From: dmba...@gmail.com [mailto:dmba...@gmail.com] On Behalf Of Douglas Bates
Sent: 19. januar 2013 16:58
To: Dirk Eddelbuettel
Cc: Søren Højsgaard; rcpp-devel@lists.r-forge.r-project.org
Subject: Re: [Rcpp-devel] RcppEigen: Getting and setting dimnames of sparse 
matrix


On Sat, Jan 19, 2013 at 10:38 AM, Douglas Bates 
<ba...@stat.wisc.edu<mailto:ba...@stat.wisc.edu>> wrote:

On thinking about this a bit more, the dimnames should be cloned before being 
assigned, otherwise you end up with two references to the same storage.  And 
once you try to clone you get into the SlotProxy area where you need to know 
what you are cloning.  One way of doing this is shown in the enclosed.  An 
alternative is

Xout.slot("Dimnames") = clone(as<SEXP>((Xin.slot("Dimnames"))));

_______________________________________________
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

Reply via email to