diff options
author | Gael Guennebaud <g.gael@free.fr> | 2013-02-23 20:13:21 +0100 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2013-02-23 20:13:21 +0100 |
commit | 274c24c26295735011df381df5fb270e59b378c1 (patch) | |
tree | 738fd58c8faf270444b14403c85af36f69aa8322 | |
parent | 74438f8aa9bfef7f1e609daa7e972cb5d82967c8 (diff) |
Avoid problematic ternary operator (http://forum.kde.org/viewtopic.php?f=74&t=109486)
-rw-r--r-- | Eigen/src/Core/SelfCwiseBinaryOp.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Eigen/src/Core/SelfCwiseBinaryOp.h b/Eigen/src/Core/SelfCwiseBinaryOp.h index 0caf2bab1..22f3047b4 100644 --- a/Eigen/src/Core/SelfCwiseBinaryOp.h +++ b/Eigen/src/Core/SelfCwiseBinaryOp.h @@ -185,7 +185,10 @@ inline Derived& DenseBase<Derived>::operator/=(const Scalar& other) internal::scalar_product_op<Scalar> >::type BinOp; typedef typename Derived::PlainObject PlainObject; SelfCwiseBinaryOp<BinOp, Derived, typename PlainObject::ConstantReturnType> tmp(derived()); - tmp = PlainObject::Constant(rows(),cols(), NumTraits<Scalar>::IsInteger ? other : Scalar(1)/other); + Scalar actual_other; + if(NumTraits<Scalar>::IsInteger) actual_other = other; + else actual_other = Scalar(1)/other; + tmp = PlainObject::Constant(rows(),cols(), actual_other); return derived(); } |