bug #1272: Disable assertion when total number of columns is zero.

Also moved assertion to finished() method and adapted unit-test
This commit is contained in:
Christoph Hertzberg
2016-08-12 15:15:34 +02:00
parent 3e2684986b
commit c1f217bbef
2 changed files with 12 additions and 8 deletions

View File

@@ -95,9 +95,7 @@ struct CommaInitializer
inline ~CommaInitializer()
{
eigen_assert((m_row+m_currentBlockRows) == m_xpr.rows()
&& m_col == m_xpr.cols()
&& "Too few coefficients passed to comma initializer (operator<<)");
finished();
}
/** \returns the built matrix once all its coefficients have been set.
@@ -107,7 +105,12 @@ struct CommaInitializer
* quaternion.fromRotationMatrix((Matrix3f() << axis0, axis1, axis2).finished());
* \endcode
*/
inline XprType& finished() { return m_xpr; }
inline XprType& finished() {
eigen_assert(((m_row+m_currentBlockRows) == m_xpr.rows() || m_xpr.cols() == 0)
&& m_col == m_xpr.cols()
&& "Too few coefficients passed to comma initializer (operator<<)");
return m_xpr;
}
XprType& m_xpr; // target expression
Index m_row; // current row id