Bugzilla – Bug 872
std::binder2nd deprecated warnings with C++11
Last modified: 2015-06-29 18:13:02 UTC
When compiling with C++11 support on the Intel compilers, lots of verbose warnings are emitted that std::binder2nd is deprecated.
These also arise when compiling with clang.
Eventually, we'll need to replace these by custom functors anyways if we want to use vectorized comparisons (Bug 97)
Created attachment 572 [details]
Replacing binder1st/binder2nd usage by custom functors
In the attached patch I replaced all usages of binder1st/binder2nd by custom functors which are then called with Array::Constant(...) as second object.
Furthermore, operator< and operator> have the same return type (with swapped arguments now (the same for <=, >=).
Probably the names can be chosen differently and some boiler-plate code can be hidden inside macros.
The functors also don't provide packet-functionality, yet (Bug 97).
Thank you for the patch, the introduction of an enum ComparisonName seems to be a bit overkill, and perhaps it would have been simpler to keep the std::* functors for now as the real fix here consists in using Constant instead of bind (as this is already the case for min/max and perhaps others) but this is preparing bug 97, so ok.
Pushed here (after hiding boiler plate code into macros):
The whole ComparisonName stuff is indeed not necessary for this, but as mentioned, this prepares resolving Bug 97.
Just happened to see this push. Unfortunately, it doesn't fix all the deprecation warnings with C++11 and g++-5.1.0:
/home/chris/neweig/eigen/Eigen/src/SparseCore/../plugins/MatrixCwiseUnaryOps.h:17:27: warning: ‘template<class _Operation> class std::binder1st’ is deprecated [-Wdeprecated-declarations]
typedef CwiseUnaryOp<std::binder1st<std::equal_to<Scalar> >, const Derived> CwiseScalarEqualReturnType;
Hm, right. Probably this requires unary functors after all.
and manually backported:
I'm still getting these warnings in 3.2.5, but not on the devel branch. The 3.2 branch apparently also needs this change backported:
/home/jagerman/research/fracdist/eigen3/Eigen/src/Core/Functors.h:973:28: warning: ‘template<class _Operation> class std::binder2nd’ is deprecated [-Wdeprecated-declarations]
struct functor_traits<std::binder2nd<T> >