Greetings, I am an (very) grateful user of Rcpp. As such I defined a function
// [[Rcpp::export]] NumericVector leftShift(NumericVector x){ for(int i=0;i<n-1;i++) x[i]=x[i+1]; return x; } expecting this function not to affect the parameter x outside the function body as it is passed in by value. However subsequent tests showed that it does affect x. What is going on here? Is sourceCpp rewriting this code in somne fashion?? Michael Meyer ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.