From 30de1651d3ecba00088bd81f0c3ed186bb08cfdc Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Fri, 21 Jan 2011 10:42:19 -0500 Subject: relax Map const correctness in eigen2 support stages <= 3 introduce new 'strict' stage 4 --- Eigen/src/Core/Map.h | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'Eigen/src/Core/Map.h') diff --git a/Eigen/src/Core/Map.h b/Eigen/src/Core/Map.h index e9534b6bb..0823376ab 100644 --- a/Eigen/src/Core/Map.h +++ b/Eigen/src/Core/Map.h @@ -124,7 +124,13 @@ template class Ma EIGEN_DENSE_PUBLIC_INTERFACE(Map) typedef typename Base::PointerType PointerType; - +#if EIGEN2_SUPPORT_STAGE <= STAGE3_FULL_EIGEN3_API + typedef const Scalar* PointerArgType; + inline PointerType cast_to_pointer_type(PointerArgType ptr) { return const_cast(ptr); } +#else + typedef PointerType PointerArgType; + inline PointerType cast_to_pointer_type(PointerArgType ptr) { return ptr; } +#endif inline Index innerStride() const { @@ -144,8 +150,8 @@ template class Ma * \param data pointer to the array to map * \param stride optional Stride object, passing the strides. */ - inline Map(PointerType data, const StrideType& stride = StrideType()) - : Base(data), m_stride(stride) + inline Map(PointerArgType data, const StrideType& stride = StrideType()) + : Base(cast_to_pointer_type(data)), m_stride(stride) { PlainObjectType::Base::_check_template_params(); } @@ -156,8 +162,8 @@ template class Ma * \param size the size of the vector expression * \param stride optional Stride object, passing the strides. */ - inline Map(PointerType data, Index size, const StrideType& stride = StrideType()) - : Base(data, size), m_stride(stride) + inline Map(PointerArgType data, Index size, const StrideType& stride = StrideType()) + : Base(cast_to_pointer_type(data), size), m_stride(stride) { PlainObjectType::Base::_check_template_params(); } @@ -169,8 +175,8 @@ template class Ma * \param cols the number of columns of the matrix expression * \param stride optional Stride object, passing the strides. */ - inline Map(PointerType data, Index rows, Index cols, const StrideType& stride = StrideType()) - : Base(data, rows, cols), m_stride(stride) + inline Map(PointerArgType data, Index rows, Index cols, const StrideType& stride = StrideType()) + : Base(cast_to_pointer_type(data), rows, cols), m_stride(stride) { PlainObjectType::Base::_check_template_params(); } -- cgit v1.2.3