bug #872: Avoid deprecated binder1st/binder2nd usage by providing custom functors for comparison operators

This commit is contained in:
Christoph Hertzberg
2015-05-07 17:28:40 +02:00
parent 4a936974a5
commit 494fa991c3
5 changed files with 102 additions and 25 deletions

View File

@@ -246,24 +246,5 @@ cube() const
return CubeReturnType(derived());
}
#define EIGEN_MAKE_SCALAR_CWISE_UNARY_OP(METHOD_NAME,FUNCTOR) \
EIGEN_DEVICE_FUNC \
inline const CwiseUnaryOp<std::binder2nd<FUNCTOR<Scalar> >, const Derived> \
METHOD_NAME(const Scalar& s) const { \
return CwiseUnaryOp<std::binder2nd<FUNCTOR<Scalar> >, const Derived> \
(derived(), std::bind2nd(FUNCTOR<Scalar>(), s)); \
} \
friend inline const CwiseUnaryOp<std::binder1st<FUNCTOR<Scalar> >, const Derived> \
METHOD_NAME(const Scalar& s, const Derived& d) { \
return CwiseUnaryOp<std::binder1st<FUNCTOR<Scalar> >, const Derived> \
(d, std::bind1st(FUNCTOR<Scalar>(), s)); \
}
EIGEN_MAKE_SCALAR_CWISE_UNARY_OP(operator==, std::equal_to)
EIGEN_MAKE_SCALAR_CWISE_UNARY_OP(operator!=, std::not_equal_to)
EIGEN_MAKE_SCALAR_CWISE_UNARY_OP(operator<, std::less)
EIGEN_MAKE_SCALAR_CWISE_UNARY_OP(operator<=, std::less_equal)
EIGEN_MAKE_SCALAR_CWISE_UNARY_OP(operator>, std::greater)
EIGEN_MAKE_SCALAR_CWISE_UNARY_OP(operator>=, std::greater_equal)