aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/Map.h
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2011-01-21 10:42:19 -0500
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2011-01-21 10:42:19 -0500
commit30de1651d3ecba00088bd81f0c3ed186bb08cfdc (patch)
tree94d8bbbcf05e324ee99e92fd0a8fbb286f65d33c /Eigen/src/Core/Map.h
parent54dfcdf86eddf6842bde39b1a6eabb10471f7eda (diff)
relax Map const correctness in eigen2 support stages <= 3
introduce new 'strict' stage 4
Diffstat (limited to 'Eigen/src/Core/Map.h')
-rw-r--r--Eigen/src/Core/Map.h20
1 files changed, 13 insertions, 7 deletions
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<typename PlainObjectType, int MapOptions, typename StrideType> 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<PointerType>(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<typename PlainObjectType, int MapOptions, typename StrideType> 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<typename PlainObjectType, int MapOptions, typename StrideType> 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<typename PlainObjectType, int MapOptions, typename StrideType> 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();
}