[Rcpp-devel] Is R_len_t the preferred type for iterating over Vector elements?

Douglas Bates bates at stat.wisc.edu
Tue Jun 15 23:06:46 CEST 2010


Suppose I want to iterate over the values of a NumericVector x.  If
one wants to "future-proof" one's code a bit, I presume the preferred
idiom is

for(R_len_t i = 0; i < x.size(); ++i) x[i] = ...

as opposed to declaring i to be an int or a size_t.  Is that correct?


More information about the Rcpp-devel mailing list