In the comment, it is said that move semantics are not adopted in Rcpp classes. Some developers prefer writing return std::move(x)
in all functions when C++11 is enabled just as the following:
NumericVector test(const NumericVector& x) {
NumericVector y(x.size());
for (int i = 0; i < x.size(); i++) {
y[i] = x[i] * 2;
}
return std::move(y);
}
I'm wondering if there's any benefit or downside writing Rcpp code like this, or any risk that code runs into trouble if the code is more complex?