Hi,

I've come across an issue when compiling some code with Rcpp >= 0.11.4 (using R 
3.1.3 with either gcc or clang on Linux, or clang on OS X).

The code that reproduces the issue is here: 
https://gist.github.com/molpopgen/b3bda09590172044ff84

Specifically, the last function is where I'm running into trouble.  I also 
tried the same ideas using C++98 (function objects instead of lambda 
expressions), and got the same results.

The short version is that Rcpp::IntegerVector::value_type appears to lose some 
info about value_type's const-ness when a const IntegerVector is passed to an 
Rcpp function.  I went back an tried older version of Rcpp and verified that 
the code from the above link compiles with version from 0.11.0 through 0.11.3.  
Starting with 0.11.4, the last function in that piece of code will no longer 
compile, and appears to think that a non-const int & is the type that it is 
looking for.

I tried the other STL-like typedefs that one may expect ( reference, 
const_reference ), and they do not exist for Rcpp vector types.

Any thoughts?  Is this intended?  Should I not write functions taking const 
references to Rcpp types?

Best,

Kevin

___________________________
Kevin Thornton
Associate Professor
Ecology and Evolutionary Biology
University of California, Irvine
http://www.molpopgen.org
http://github.com/molpopgen
http://github.com/ThorntonLab






_______________________________________________
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