aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/DenseStorage.h
diff options
context:
space:
mode:
authorGravatar Christoph Hertzberg <chtz@informatik.uni-bremen.de>2015-04-16 15:47:06 +0200
committerGravatar Christoph Hertzberg <chtz@informatik.uni-bremen.de>2015-04-16 15:47:06 +0200
commit9d7843d0d0879a5c22741f19aaab7ad116bd352e (patch)
treeaab634d537a1c05c398beb8d2db67b78d4392686 /Eigen/src/Core/DenseStorage.h
parent3be9f5c4d7c114eeaf7ce372cccc0e1a2734bac9 (diff)
Add internal assertions to DenseStorage constructor
Diffstat (limited to 'Eigen/src/Core/DenseStorage.h')
-rw-r--r--Eigen/src/Core/DenseStorage.h23
1 files changed, 18 insertions, 5 deletions
diff --git a/Eigen/src/Core/DenseStorage.h b/Eigen/src/Core/DenseStorage.h
index 8fcc83a5a..37759a585 100644
--- a/Eigen/src/Core/DenseStorage.h
+++ b/Eigen/src/Core/DenseStorage.h
@@ -358,7 +358,12 @@ template<typename T, int _Options> class DenseStorage<T, Dynamic, Dynamic, Dynam
: m_data(0), m_rows(0), m_cols(0) {}
DenseStorage(Index size, Index nbRows, Index nbCols)
: m_data(internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(size)), m_rows(nbRows), m_cols(nbCols)
- { EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN }
+ {
+ EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN
+ eigen_internal_assert(size==nbRows*nbCols && nbRows>=0 && nbCols >=0);
+ EIGEN_ONLY_USED_FOR_DEBUG(nbRows);
+ EIGEN_ONLY_USED_FOR_DEBUG(nbCols);
+ }
DenseStorage(const DenseStorage& other)
: m_data(internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(other.m_rows*other.m_cols))
, m_rows(other.m_rows)
@@ -433,8 +438,12 @@ template<typename T, int _Rows, int _Options> class DenseStorage<T, Dynamic, _Ro
public:
EIGEN_DEVICE_FUNC DenseStorage() : m_data(0), m_cols(0) {}
explicit DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_cols(0) {}
- DenseStorage(Index size, Index, Index nbCols) : m_data(internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(size)), m_cols(nbCols)
- { EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN }
+ DenseStorage(Index size, Index nbRows, Index nbCols) : m_data(internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(size)), m_cols(nbCols)
+ {
+ EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN
+ eigen_internal_assert(size==nbRows*nbCols && nbRows==_Rows && nbCols >=0);
+ EIGEN_ONLY_USED_FOR_DEBUG(nbRows);
+ }
DenseStorage(const DenseStorage& other)
: m_data(internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(_Rows*other.m_cols))
, m_cols(other.m_cols)
@@ -502,8 +511,12 @@ template<typename T, int _Cols, int _Options> class DenseStorage<T, Dynamic, Dyn
public:
EIGEN_DEVICE_FUNC DenseStorage() : m_data(0), m_rows(0) {}
explicit DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_rows(0) {}
- DenseStorage(Index size, Index nbRows, Index) : m_data(internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(size)), m_rows(nbRows)
- { EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN }
+ DenseStorage(Index size, Index nbRows, Index nbCols) : m_data(internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(size)), m_rows(nbRows)
+ {
+ EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN
+ eigen_internal_assert(size==nbRows*nbCols && nbRows>=0 && nbCols == _Cols);
+ EIGEN_ONLY_USED_FOR_DEBUG(nbCols);
+ }
DenseStorage(const DenseStorage& other)
: m_data(internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(other.m_rows*_Cols))
, m_rows(other.m_rows)