Avoid comparisons between different index types.

This commit is contained in:
Gael Guennebaud 2014-09-29 10:27:51 +02:00
parent 2946992ad4
commit f0a62c90bc

View File

@ -303,7 +303,9 @@ class PermutationMatrix : public PermutationBase<PermutationMatrix<SizeAtCompile
/** Constructs an uninitialized permutation matrix of given size. /** Constructs an uninitialized permutation matrix of given size.
*/ */
explicit inline PermutationMatrix(Index size) : m_indices(size) explicit inline PermutationMatrix(Index size) : m_indices(size)
{} {
eigen_internal_assert(size <= NumTraits<StorageIndexType>::highest());
}
/** Copy constructor. */ /** Copy constructor. */
template<typename OtherDerived> template<typename OtherDerived>
@ -375,7 +377,8 @@ class PermutationMatrix : public PermutationBase<PermutationMatrix<SizeAtCompile
: m_indices(other.nestedPermutation().size()) : m_indices(other.nestedPermutation().size())
{ {
eigen_internal_assert(m_indices.size() <= NumTraits<StorageIndexType>::highest()); eigen_internal_assert(m_indices.size() <= NumTraits<StorageIndexType>::highest());
for (StorageIndexType i=0; i<m_indices.size();++i) StorageIndexType end = StorageIndexType(m_indices.size());
for (StorageIndexType i=0; i<end;++i)
m_indices.coeffRef(other.nestedPermutation().indices().coeff(i)) = i; m_indices.coeffRef(other.nestedPermutation().indices().coeff(i)) = i;
} }
template<typename Lhs,typename Rhs> template<typename Lhs,typename Rhs>