Get rid of a nasty const_cast by introducing a MatrixConstRef class.

Remove the __restrict__'s for now.
This commit is contained in:
Benoit Jacob
2007-09-29 17:27:20 +00:00
parent ee63e15e2c
commit 7d41ad9d90
10 changed files with 89 additions and 39 deletions

View File

@@ -56,6 +56,7 @@ template<typename Scalar, typename Derived> class EiObject
public:
typedef typename EiForwardDecl<Derived>::Ref Ref;
typedef typename EiForwardDecl<Derived>::ConstRef ConstRef;
int rows() const { return static_cast<const Derived *>(this)->_rows(); }
int cols() const { return static_cast<const Derived *>(this)->_cols(); }
@@ -64,10 +65,10 @@ template<typename Scalar, typename Derived> class EiObject
Ref ref()
{ return static_cast<Derived *>(this)->_ref(); }
Ref ref() const
{ return static_cast<const Derived *>(this)->_ref(); }
ConstRef constRef() const
{ return static_cast<const Derived *>(this)->_constRef(); }
Scalar& EI_RESTRICT write(int row, int col)
Scalar& write(int row, int col)
{
return static_cast<Derived *>(this)->_write(row, col);
}
@@ -127,7 +128,7 @@ template<typename Scalar, typename Derived> class EiObject
Scalar operator()(int row, int col = 0) const
{ return read(row, col); }
Scalar& EI_RESTRICT operator()(int row, int col = 0)
Scalar& operator()(int row, int col = 0)
{ return write(row, col); }
EiEval<Derived> eval() const EI_ALWAYS_INLINE;