From 6f0f6f792e441c32727ed945686fefe02e6bdbc6 Mon Sep 17 00:00:00 2001 From: daravi Date: Wed, 16 Sep 2020 02:06:53 +0000 Subject: Fix compiler error due to c++20 operator== generation rules --- Eigen/src/plugins/ArrayCwiseBinaryOps.h | 42 ++++++++++++++++----------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'Eigen/src/plugins') diff --git a/Eigen/src/plugins/ArrayCwiseBinaryOps.h b/Eigen/src/plugins/ArrayCwiseBinaryOps.h index 0e5d5445b..1d703b6da 100644 --- a/Eigen/src/plugins/ArrayCwiseBinaryOps.h +++ b/Eigen/src/plugins/ArrayCwiseBinaryOps.h @@ -131,39 +131,39 @@ const CwiseBinaryOp,Derived,Constant > pow( // TODO code generating macros could be moved to Macros.h and could include generation of documentation -#define EIGEN_MAKE_CWISE_COMP_OP(OP, COMPARATOR) \ +#define EIGEN_MAKE_CWISE_COMP_OP(OP_NAME, OP, COMPARATOR) \ template \ -EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryOp, const Derived, const OtherDerived> \ -OP(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other) const \ +EIGEN_DEVICE_FUNC friend EIGEN_STRONG_INLINE const CwiseBinaryOp, const Derived, const OtherDerived> \ +OP_NAME(const EIGEN_CURRENT_STORAGE_BASE_CLASS& lhs, const EIGEN_CURRENT_STORAGE_BASE_CLASS& rhs) \ { \ - return CwiseBinaryOp, const Derived, const OtherDerived>(derived(), other.derived()); \ + return CwiseBinaryOp, const Derived, const OtherDerived>(lhs.derived(), rhs.derived()); \ }\ typedef CwiseBinaryOp, const Derived, const CwiseNullaryOp, PlainObject> > Cmp ## COMPARATOR ## ReturnType; \ typedef CwiseBinaryOp, const CwiseNullaryOp, PlainObject>, const Derived > RCmp ## COMPARATOR ## ReturnType; \ -EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Cmp ## COMPARATOR ## ReturnType \ -OP(const Scalar& s) const { \ - return this->OP(Derived::PlainObject::Constant(rows(), cols(), s)); \ +EIGEN_DEVICE_FUNC friend EIGEN_STRONG_INLINE const Cmp ## COMPARATOR ## ReturnType \ +OP_NAME(const EIGEN_CURRENT_STORAGE_BASE_CLASS& lhs, const Scalar& rhs) { \ + return lhs OP Derived::PlainObject::Constant(lhs.rows(), lhs.cols(), rhs); \ } \ EIGEN_DEVICE_FUNC friend EIGEN_STRONG_INLINE const RCmp ## COMPARATOR ## ReturnType \ -OP(const Scalar& s, const EIGEN_CURRENT_STORAGE_BASE_CLASS& d) { \ - return Derived::PlainObject::Constant(d.rows(), d.cols(), s).OP(d); \ +OP_NAME(const Scalar& lhs, const EIGEN_CURRENT_STORAGE_BASE_CLASS& rhs) { \ + return Derived::PlainObject::Constant(rhs.rows(), rhs.cols(), lhs) OP rhs; \ } -#define EIGEN_MAKE_CWISE_COMP_R_OP(OP, R_OP, RCOMPARATOR) \ +#define EIGEN_MAKE_CWISE_COMP_R_OP(OP_NAME, R_OP, RCOMPARATOR) \ template \ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryOp, const OtherDerived, const Derived> \ -OP(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other) const \ +OP_NAME(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other) const \ { \ return CwiseBinaryOp, const OtherDerived, const Derived>(other.derived(), derived()); \ } \ EIGEN_DEVICE_FUNC \ inline const RCmp ## RCOMPARATOR ## ReturnType \ -OP(const Scalar& s) const { \ - return Derived::PlainObject::Constant(rows(), cols(), s).R_OP(*this); \ +OP_NAME(const Scalar& s) const { \ + return Derived::PlainObject::Constant(rows(), cols(), s) R_OP *this; \ } \ friend inline const Cmp ## RCOMPARATOR ## ReturnType \ -OP(const Scalar& s, const Derived& d) { \ - return d.R_OP(Derived::PlainObject::Constant(d.rows(), d.cols(), s)); \ +OP_NAME(const Scalar& s, const Derived& d) { \ + return d R_OP Derived::PlainObject::Constant(d.rows(), d.cols(), s); \ } @@ -175,7 +175,7 @@ OP(const Scalar& s, const Derived& d) { \ * * \sa all(), any(), operator>(), operator<=() */ -EIGEN_MAKE_CWISE_COMP_OP(operator<, LT) +EIGEN_MAKE_CWISE_COMP_OP(operator<, <, LT) /** \returns an expression of the coefficient-wise \<= operator of *this and \a other * @@ -184,7 +184,7 @@ EIGEN_MAKE_CWISE_COMP_OP(operator<, LT) * * \sa all(), any(), operator>=(), operator<() */ -EIGEN_MAKE_CWISE_COMP_OP(operator<=, LE) +EIGEN_MAKE_CWISE_COMP_OP(operator<=, <=, LE) /** \returns an expression of the coefficient-wise \> operator of *this and \a other * @@ -193,7 +193,7 @@ EIGEN_MAKE_CWISE_COMP_OP(operator<=, LE) * * \sa all(), any(), operator>=(), operator<() */ -EIGEN_MAKE_CWISE_COMP_R_OP(operator>, operator<, LT) +EIGEN_MAKE_CWISE_COMP_R_OP(operator>, <, LT) /** \returns an expression of the coefficient-wise \>= operator of *this and \a other * @@ -202,7 +202,7 @@ EIGEN_MAKE_CWISE_COMP_R_OP(operator>, operator<, LT) * * \sa all(), any(), operator>(), operator<=() */ -EIGEN_MAKE_CWISE_COMP_R_OP(operator>=, operator<=, LE) +EIGEN_MAKE_CWISE_COMP_R_OP(operator>=, <=, LE) /** \returns an expression of the coefficient-wise == operator of *this and \a other * @@ -216,7 +216,7 @@ EIGEN_MAKE_CWISE_COMP_R_OP(operator>=, operator<=, LE) * * \sa all(), any(), isApprox(), isMuchSmallerThan() */ -EIGEN_MAKE_CWISE_COMP_OP(operator==, EQ) +EIGEN_MAKE_CWISE_COMP_OP(operator==, ==, EQ) /** \returns an expression of the coefficient-wise != operator of *this and \a other * @@ -230,7 +230,7 @@ EIGEN_MAKE_CWISE_COMP_OP(operator==, EQ) * * \sa all(), any(), isApprox(), isMuchSmallerThan() */ -EIGEN_MAKE_CWISE_COMP_OP(operator!=, NEQ) +EIGEN_MAKE_CWISE_COMP_OP(operator!=, !=, NEQ) #undef EIGEN_MAKE_CWISE_COMP_OP -- cgit v1.2.3