mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-15 19:03:12 +08:00
Add internal assertions to purely fixed-size DenseStorage, mark optional variables always as unused
This commit is contained in:
parent
da5b98a94d
commit
4f126b862d
@ -218,7 +218,13 @@ template<typename T, int Size, int _Rows, int _Cols, int _Options> class DenseSt
|
|||||||
if (this != &other) m_data = other.m_data;
|
if (this != &other) m_data = other.m_data;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
EIGEN_DEVICE_FUNC DenseStorage(Index,Index,Index) {}
|
EIGEN_DEVICE_FUNC DenseStorage(Index size, Index nbRows, Index nbCols) {
|
||||||
|
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN
|
||||||
|
eigen_internal_assert(size==nbRows*nbCols && nbRows==_Rows && nbCols==_Cols);
|
||||||
|
EIGEN_UNUSED_VARIABLE(size);
|
||||||
|
EIGEN_UNUSED_VARIABLE(nbRows);
|
||||||
|
EIGEN_UNUSED_VARIABLE(nbCols);
|
||||||
|
}
|
||||||
EIGEN_DEVICE_FUNC void swap(DenseStorage& other) { std::swap(m_data,other.m_data); }
|
EIGEN_DEVICE_FUNC void swap(DenseStorage& other) { std::swap(m_data,other.m_data); }
|
||||||
EIGEN_DEVICE_FUNC static Index rows(void) {return _Rows;}
|
EIGEN_DEVICE_FUNC static Index rows(void) {return _Rows;}
|
||||||
EIGEN_DEVICE_FUNC static Index cols(void) {return _Cols;}
|
EIGEN_DEVICE_FUNC static Index cols(void) {return _Cols;}
|
||||||
@ -361,8 +367,6 @@ template<typename T, int _Options> class DenseStorage<T, Dynamic, Dynamic, Dynam
|
|||||||
{
|
{
|
||||||
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN
|
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN
|
||||||
eigen_internal_assert(size==nbRows*nbCols && nbRows>=0 && nbCols >=0);
|
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)
|
DenseStorage(const DenseStorage& other)
|
||||||
: m_data(internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(other.m_rows*other.m_cols))
|
: m_data(internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(other.m_rows*other.m_cols))
|
||||||
@ -442,7 +446,7 @@ template<typename T, int _Rows, int _Options> class DenseStorage<T, Dynamic, _Ro
|
|||||||
{
|
{
|
||||||
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN
|
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN
|
||||||
eigen_internal_assert(size==nbRows*nbCols && nbRows==_Rows && nbCols >=0);
|
eigen_internal_assert(size==nbRows*nbCols && nbRows==_Rows && nbCols >=0);
|
||||||
EIGEN_ONLY_USED_FOR_DEBUG(nbRows);
|
EIGEN_UNUSED_VARIABLE(nbRows);
|
||||||
}
|
}
|
||||||
DenseStorage(const DenseStorage& other)
|
DenseStorage(const DenseStorage& other)
|
||||||
: m_data(internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(_Rows*other.m_cols))
|
: m_data(internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(_Rows*other.m_cols))
|
||||||
@ -515,7 +519,7 @@ template<typename T, int _Cols, int _Options> class DenseStorage<T, Dynamic, Dyn
|
|||||||
{
|
{
|
||||||
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN
|
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN
|
||||||
eigen_internal_assert(size==nbRows*nbCols && nbRows>=0 && nbCols == _Cols);
|
eigen_internal_assert(size==nbRows*nbCols && nbRows>=0 && nbCols == _Cols);
|
||||||
EIGEN_ONLY_USED_FOR_DEBUG(nbCols);
|
EIGEN_UNUSED_VARIABLE(nbCols);
|
||||||
}
|
}
|
||||||
DenseStorage(const DenseStorage& other)
|
DenseStorage(const DenseStorage& other)
|
||||||
: m_data(internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(other.m_rows*_Cols))
|
: m_data(internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(other.m_rows*_Cols))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user