compilation fix: make the generic template ctor explicit

This commit is contained in:
Gael Guennebaud 2009-10-13 09:23:09 +02:00
parent 2049f742e4
commit 1443094072
2 changed files with 9 additions and 13 deletions

View File

@ -45,14 +45,10 @@ struct ei_traits<Replicate<MatrixType,RowFactor,ColFactor> >
typedef typename ei_nested<MatrixType>::type MatrixTypeNested; typedef typename ei_nested<MatrixType>::type MatrixTypeNested;
typedef typename ei_unref<MatrixTypeNested>::type _MatrixTypeNested; typedef typename ei_unref<MatrixTypeNested>::type _MatrixTypeNested;
enum { enum {
RowsPlusOne = (MatrixType::RowsAtCompileTime != Dynamic) ? RowsAtCompileTime = RowFactor==Dynamic || int(MatrixType::RowsAtCompileTime)==Dynamic
int(MatrixType::RowsAtCompileTime) + 1 : Dynamic,
ColsPlusOne = (MatrixType::ColsAtCompileTime != Dynamic) ?
int(MatrixType::ColsAtCompileTime) + 1 : Dynamic,
RowsAtCompileTime = RowFactor==Dynamic || MatrixType::RowsAtCompileTime==Dynamic
? Dynamic ? Dynamic
: RowFactor * MatrixType::RowsAtCompileTime, : RowFactor * MatrixType::RowsAtCompileTime,
ColsAtCompileTime = ColFactor==Dynamic || MatrixType::ColsAtCompileTime==Dynamic ColsAtCompileTime = ColFactor==Dynamic || int(MatrixType::ColsAtCompileTime)==Dynamic
? Dynamic ? Dynamic
: ColFactor * MatrixType::ColsAtCompileTime, : ColFactor * MatrixType::ColsAtCompileTime,
MaxRowsAtCompileTime = RowsAtCompileTime, MaxRowsAtCompileTime = RowsAtCompileTime,
@ -70,7 +66,7 @@ template<typename MatrixType,int RowFactor,int ColFactor> class Replicate
EIGEN_GENERIC_PUBLIC_INTERFACE(Replicate) EIGEN_GENERIC_PUBLIC_INTERFACE(Replicate)
template<typename OriginalMatrixType> template<typename OriginalMatrixType>
inline Replicate(const OriginalMatrixType& matrix) inline explicit Replicate(const OriginalMatrixType& matrix)
: m_matrix(matrix), m_rowFactor(RowFactor), m_colFactor(ColFactor) : m_matrix(matrix), m_rowFactor(RowFactor), m_colFactor(ColFactor)
{ {
EIGEN_STATIC_ASSERT((ei_is_same_type<MatrixType,OriginalMatrixType>::ret), EIGEN_STATIC_ASSERT((ei_is_same_type<MatrixType,OriginalMatrixType>::ret),
@ -113,7 +109,7 @@ template<int RowFactor, int ColFactor>
inline const Replicate<Derived,RowFactor,ColFactor> inline const Replicate<Derived,RowFactor,ColFactor>
MatrixBase<Derived>::replicate() const MatrixBase<Derived>::replicate() const
{ {
return derived(); return Replicate<Derived,RowFactor,ColFactor>(derived());
} }
/** \nonstableyet /** \nonstableyet