Description
Kurt Hornik emailed me because of an (unrelated) RcppArmadillo issue (involving a possible need for -latomic
on Debian, that is still TBD) and noted that newer compilers nag a bit with respect to std::unary_function()
and std::binary_function()
. See for example in the results for RcppRedis which I looked at yesterday when it updated:
Result: WARN
Found the following significant warnings:
/home/hornik/tmp/R.check/r-devel-gcc/Work/build/Packages/Rcpp/include/Rcpp/Language.h:180:36: warning: ‘template<class _Arg, class _Result> struct std::unary_function’ is deprecated [-Wdeprecated-declarations]
/home/hornik/tmp/R.check/r-devel-gcc/Work/build/Packages/Rcpp/include/Rcpp/Language.h:197:37: warning: ‘template<class _Arg1, class _Arg2, class _Result> struct std::binary_function’ is deprecated [-Wdeprecated-declarations]
/home/hornik/tmp/R.check/r-devel-gcc/Work/build/Packages/Rcpp/include/Rcpp/StringTransformer.h:30:47: warning: ‘template<class _Arg, class _Result> struct std::unary_function’ is deprecated [-Wdeprecated-declarations]
When he emailed me earlier yesterday he only mentioned the thrid of these for StringTransformer
and I quickly played with fix -- this is in fact simple enough thanks to std::function
-- using std::function<bool(int)>
instead of the deprecated std::unary_function<int, bool>
is all it took in another example. I think replacing std::binary_function
will be equally simple.
The question now is how to best implement the check as we need to keep the old code for compatibility's sake. Shall we just use
#if __cplusplus >= 201103L
to flip all C++11 or later compilation to use std::function()
? Or are there any downsides I am not seeing?
(We will of course test fully at CRAN).
While we are at this we should probably also cherry-pick in #1193 which fixed a minor hoopla w.r.t. to C++98.
So these two changes, and we call it Rcpp 1.0.8-1 ? (And I will make sure to turn the unit test for three vs four version numbers off.)
Or do we have preference for four dots and call it 1.0.8.1 ?