Example:
// [[Rcpp::export]]
size_t z1(SEXP x) {
return Rf_xlength(x);
}
// [[Rcpp::export]]
size_t z2(NumericVector x) {
// do anything or nothing
return 1;
}
R:
x <- seq(1,1e10)
z1(x)
[1] 1e+10
z2(x)
# computer hard crash
Suppose as example, I just wanted to take the first 10 elements of an ALTREP vector. What would be the best way to do so in C++?