In the Matrix constructor taking (rows, cols), statically assert that the types are integer.

The 2D vector ctor taking (x, y) is not concerned.
This commit is contained in:
Benoit Jacob
2011-11-05 23:56:48 -04:00
parent 478de03bd8
commit ab3f138b23
2 changed files with 4 additions and 0 deletions

View File

@@ -596,6 +596,9 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type
template<typename T0, typename T1>
EIGEN_STRONG_INLINE void _init2(Index rows, Index cols, typename internal::enable_if<Base::SizeAtCompileTime!=2,T0>::type* = 0)
{
EIGEN_STATIC_ASSERT(bool(NumTraits<T0>::IsInteger) &&
bool(NumTraits<T1>::IsInteger),
FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED)
eigen_assert(rows >= 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows)
&& cols >= 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols));
internal::check_rows_cols_for_overflow(rows, cols);