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:
@@ -55,18 +55,14 @@ template<typename Scalar, typename Derived> class Object
|
||||
static const bool IsVector = RowsAtCompileTime == 1 || ColsAtCompileTime == 1;
|
||||
|
||||
typedef typename ForwardDecl<Derived>::Ref Ref;
|
||||
typedef typename ForwardDecl<Derived>::ConstRef ConstRef;
|
||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||
|
||||
int rows() const { return static_cast<const Derived *>(this)->_rows(); }
|
||||
int cols() const { return static_cast<const Derived *>(this)->_cols(); }
|
||||
int size() const { return rows() * cols(); }
|
||||
|
||||
Ref ref()
|
||||
{ return static_cast<Derived *>(this)->_ref(); }
|
||||
|
||||
ConstRef constRef() const
|
||||
{ return static_cast<const Derived *>(this)->_constRef(); }
|
||||
Ref ref() const
|
||||
{ return static_cast<const Derived *>(this)->_ref(); }
|
||||
|
||||
Scalar& write(int row, int col)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user