This is probably related to this:
template int RTYPE
struct r_vector_const_iterator {
typedef typename storage_typeRTYPE::type* type ;
};
There should be a const there somewhere.
FWIW, more modern implementations of R/C++ are more safe on that issue:
Dear all,
By accident I noticed that indexing with x(i) and x[i] gives remarkable
difference in computing time. For example:
library(Rcpp)
cppFunction('
IntegerVector insert1 (int n){
IntegerVector z(n);
for (int i=0; in; ++i) z(i) = i; // NOTICE: using ()
return z;
}')
cppFunction('
Le 27 nov. 2014 à 13:22, Søren Højsgaard sor...@math.aau.dk a écrit :
Dear all,
By accident I noticed that indexing with x(i) and x[i] gives remarkable
difference in computing time. For example:
library(Rcpp)
cppFunction('
IntegerVector insert1 (int n){
IntegerVector z(n);
for