[Rcpp-devel] Is R_len_t the preferred type for iterating over Vector elements?
Romain Francois
romain.francois at dbmail.com
Tue Jun 15 23:14:09 CEST 2010
Le 15/06/10 23:06, Douglas Bates a écrit :
>
> 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?
yep ... although some of the code in Rcpp is not correct, this is
probably the best type to use.
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://bit.ly/98Uf7u : Rcpp 0.8.1
|- http://bit.ly/c6YnCi : graph gallery collage
`- http://bit.ly/bZ7ltC : inline 0.3.5
More information about the Rcpp-devel
mailing list