third pass of const-correctness fixes (bug #54), hopefully the last one...

This commit is contained in:
Benoit Jacob
2011-01-07 05:16:01 -05:00
parent c7baf07a3e
commit 98f0274305
7 changed files with 82 additions and 19 deletions

View File

@@ -232,8 +232,8 @@ struct blas_traits<Transpose<NestedXpr> >
typedef typename NestedXpr::Scalar Scalar;
typedef blas_traits<NestedXpr> Base;
typedef Transpose<NestedXpr> XprType;
typedef Transpose<typename Base::_ExtractType> ExtractType;
typedef Transpose<typename Base::_ExtractType> _ExtractType;
typedef Transpose<const typename Base::_ExtractType> ExtractType; // const to get rid of a compile error; anyway blas traits are only used on the RHS
typedef Transpose<const typename Base::_ExtractType> _ExtractType;
typedef typename conditional<bool(Base::HasUsableDirectAccess),
ExtractType,
typename ExtractType::PlainObject

View File

@@ -333,6 +333,52 @@ template<typename T, int n=1, typename PlainObject = typename eval<T>::type> str
>::type type;
};
template<typename ExpressionType>
struct as_argument
{
typedef typename nested<ExpressionType>::type type;
};
template<typename ExpressionType>
struct as_argument<const ExpressionType>
{
typedef const typename nested<ExpressionType>::type type;
};
template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
struct as_argument<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
{
typedef Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> MatrixType;
typedef MatrixType& type;
};
template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
struct as_argument<const Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
{
typedef Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> MatrixType;
typedef const MatrixType& type;
};
template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
struct as_argument<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
{
typedef Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> ArrayType;
typedef ArrayType& type;
};
template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
struct as_argument<const Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
{
typedef Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> ArrayType;
typedef const ArrayType& type;
};
template<typename T>
T* const_cast_ptr(const T* ptr)
{
return const_cast<T*>(ptr);
}
template<typename Derived, typename XprKind = typename traits<Derived>::XprKind>
struct dense_xpr_base
{