mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
make shameless use of const_cast to reduce code redundancy. This means Eigen2
gives up enforcing constness. I really tried to enforce it, but it really was much hassle because our expression templates can be lvalues (not only rvalues) and so much code had to be written twice.
This commit is contained in:
@@ -66,8 +66,8 @@ template<typename Lhs, typename Rhs> class Product
|
||||
{
|
||||
public:
|
||||
typedef typename Lhs::Scalar Scalar;
|
||||
typedef typename Lhs::ConstRef LhsRef;
|
||||
typedef typename Rhs::ConstRef RhsRef;
|
||||
typedef typename Lhs::Ref LhsRef;
|
||||
typedef typename Rhs::Ref RhsRef;
|
||||
friend class Object<Scalar, Product>;
|
||||
|
||||
static const int RowsAtCompileTime = Lhs::RowsAtCompileTime,
|
||||
@@ -86,7 +86,6 @@ template<typename Lhs, typename Rhs> class Product
|
||||
|
||||
private:
|
||||
const Product& _ref() const { return *this; }
|
||||
const Product& _constRef() const { return *this; }
|
||||
int _rows() const { return m_lhs.rows(); }
|
||||
int _cols() const { return m_rhs.cols(); }
|
||||
|
||||
@@ -115,7 +114,7 @@ template<typename OtherDerived>
|
||||
Product<Derived, OtherDerived>
|
||||
Object<Scalar, Derived>::lazyProduct(const Object<Scalar, OtherDerived> &other) const
|
||||
{
|
||||
return Product<Derived, OtherDerived>(constRef(), other.constRef());
|
||||
return Product<Derived, OtherDerived>(ref(), other.ref());
|
||||
}
|
||||
|
||||
template<typename Scalar, typename Derived1, typename Derived2>
|
||||
|
||||
Reference in New Issue
Block a user