aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/Zero.h
diff options
context:
space:
mode:
Diffstat (limited to 'Eigen/src/Core/Zero.h')
-rw-r--r--Eigen/src/Core/Zero.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/Eigen/src/Core/Zero.h b/Eigen/src/Core/Zero.h
index 2d3ec264e..aad2f382d 100644
--- a/Eigen/src/Core/Zero.h
+++ b/Eigen/src/Core/Zero.h
@@ -32,12 +32,7 @@ template<typename MatrixType> class Zero : NoOperatorEquals,
public:
typedef typename MatrixType::Scalar Scalar;
friend class MatrixBase<Scalar, Zero<MatrixType> >;
-
- Zero(int rows, int cols) : m_rows(rows), m_cols(cols)
- {
- assert(rows > 0 && cols > 0);
- }
-
+
private:
static const int _RowsAtCompileTime = MatrixType::RowsAtCompileTime,
_ColsAtCompileTime = MatrixType::ColsAtCompileTime;
@@ -51,6 +46,15 @@ template<typename MatrixType> class Zero : NoOperatorEquals,
return static_cast<Scalar>(0);
}
+ public:
+ Zero(int rows, int cols) : m_rows(rows), m_cols(cols)
+ {
+ assert(rows > 0
+ && (_RowsAtCompileTime == Dynamic || _RowsAtCompileTime == rows)
+ && cols > 0
+ && (_ColsAtCompileTime == Dynamic || _ColsAtCompileTime == cols));
+ }
+
protected:
int m_rows, m_cols;
};