Add DenseStorage specializations for dynamic size with MaxSize = 0 (bug #288).

This is necessary for instantiations like Matrix<float,Dynamic,Dynamic,0,0,0>.
This commit is contained in:
Jitse Niesen 2011-06-24 13:47:11 +01:00
parent 16db255333
commit 0b308e79c4
2 changed files with 15 additions and 0 deletions

View File

@ -128,6 +128,16 @@ template<typename T, int _Rows, int _Cols, int _Options> class DenseStorage<T, 0
inline T *data() { return 0; }
};
// more specializations for null matrices; these are necessary to resolve ambiguities
template<typename T, int _Options> class DenseStorage<T, 0, Dynamic, Dynamic, _Options>
: public DenseStorage<T, 0, 0, 0, _Options> { };
template<typename T, int _Rows, int _Options> class DenseStorage<T, 0, _Rows, Dynamic, _Options>
: public DenseStorage<T, 0, 0, 0, _Options> { };
template<typename T, int _Cols, int _Options> class DenseStorage<T, 0, Dynamic, _Cols, _Options>
: public DenseStorage<T, 0, 0, 0, _Options> { };
// dynamic-size matrix with fixed-size storage
template<typename T, int Size, int _Options> class DenseStorage<T, Size, Dynamic, Dynamic, _Options>
{

View File

@ -62,8 +62,13 @@ void test_zerosized()
zeroSizedMatrix<Matrix3i>();
zeroSizedMatrix<Matrix<float, 2, Dynamic> >();
zeroSizedMatrix<MatrixXf>();
zeroSizedMatrix<Matrix<float, 0, 0> >();
zeroSizedMatrix<Matrix<float, Dynamic, 0, 0, 0, 0> >();
zeroSizedMatrix<Matrix<float, 0, Dynamic, 0, 0, 0> >();
zeroSizedMatrix<Matrix<float, Dynamic, Dynamic, 0, 0, 0> >();
zeroSizedVector<Vector2d>();
zeroSizedVector<Vector3i>();
zeroSizedVector<VectorXf>();
zeroSizedVector<Matrix<float, 0, 1> >();
}