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:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user