Hello,

I have a suggestion for an additional feature of Rcpp. It would be nice to have const_iterators besides mutable iterators for Rcpp::NumericVector (and other vectors and matrices). This would make it easier to use templated functions like the one below, which can be used with std::vectors _and_ Rcpp::NumericVectors:

template <typename Vector>
void foo(const Vector& v) {
 typename Vector::const_iterator v_it=v.begin(), v_end=v.end();
 for (; v_it!=v_end; ++v_it) {
   // do amazing stuff
 }
}

Best regards,
Peter
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to