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:
Benoit Jacob
2007-10-15 05:56:21 +00:00
parent f355ef2df0
commit 884a718b0a
20 changed files with 34 additions and 83 deletions

View File

@@ -32,13 +32,11 @@ class Matrix : public Object<_Scalar, Matrix<_Scalar, _Rows, _Cols> >,
{
public:
friend class Object<_Scalar, Matrix>;
typedef Object<_Scalar, Matrix> Base;
typedef MatrixStorage<_Scalar, _Rows, _Cols> Storage;
typedef Object<_Scalar, Matrix> Base;
typedef MatrixStorage<_Scalar, _Rows, _Cols> Storage;
typedef _Scalar Scalar;
typedef MatrixRef<Matrix> Ref;
typedef MatrixConstRef<Matrix> ConstRef;
typedef MatrixRef<Matrix> Ref;
friend class MatrixRef<Matrix>;
friend class MatrixConstRef<Matrix>;
static const int RowsAtCompileTime = _Rows, ColsAtCompileTime = _Cols;
@@ -49,8 +47,7 @@ class Matrix : public Object<_Scalar, Matrix<_Scalar, _Rows, _Cols> >,
{ return Storage::m_array; }
private:
Ref _ref() { return Ref(*this); }
ConstRef _constRef() const { return ConstRef(*this); }
Ref _ref() const { return Ref(*this); }
const Scalar& _read(int row, int col) const
{