From 14430940729b043ae14576d388555fc048619a3c Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Tue, 13 Oct 2009 09:23:09 +0200 Subject: [PATCH] compilation fix: make the generic template ctor explicit --- Eigen/src/Array/Replicate.h | 12 ++++-------- test/array_replicate.cpp | 10 +++++----- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/Eigen/src/Array/Replicate.h b/Eigen/src/Array/Replicate.h index b20bcd49a..653bda666 100644 --- a/Eigen/src/Array/Replicate.h +++ b/Eigen/src/Array/Replicate.h @@ -45,14 +45,10 @@ struct ei_traits > typedef typename ei_nested::type MatrixTypeNested; typedef typename ei_unref::type _MatrixTypeNested; enum { - RowsPlusOne = (MatrixType::RowsAtCompileTime != Dynamic) ? - int(MatrixType::RowsAtCompileTime) + 1 : Dynamic, - ColsPlusOne = (MatrixType::ColsAtCompileTime != Dynamic) ? - int(MatrixType::ColsAtCompileTime) + 1 : Dynamic, - RowsAtCompileTime = RowFactor==Dynamic || MatrixType::RowsAtCompileTime==Dynamic + RowsAtCompileTime = RowFactor==Dynamic || int(MatrixType::RowsAtCompileTime)==Dynamic ? Dynamic : RowFactor * MatrixType::RowsAtCompileTime, - ColsAtCompileTime = ColFactor==Dynamic || MatrixType::ColsAtCompileTime==Dynamic + ColsAtCompileTime = ColFactor==Dynamic || int(MatrixType::ColsAtCompileTime)==Dynamic ? Dynamic : ColFactor * MatrixType::ColsAtCompileTime, MaxRowsAtCompileTime = RowsAtCompileTime, @@ -70,7 +66,7 @@ template class Replicate EIGEN_GENERIC_PUBLIC_INTERFACE(Replicate) template - inline Replicate(const OriginalMatrixType& matrix) + inline explicit Replicate(const OriginalMatrixType& matrix) : m_matrix(matrix), m_rowFactor(RowFactor), m_colFactor(ColFactor) { EIGEN_STATIC_ASSERT((ei_is_same_type::ret), @@ -113,7 +109,7 @@ template inline const Replicate MatrixBase::replicate() const { - return derived(); + return Replicate(derived()); } /** \nonstableyet diff --git a/test/array_replicate.cpp b/test/array_replicate.cpp index d1608915f..cd0f65f26 100644 --- a/test/array_replicate.cpp +++ b/test/array_replicate.cpp @@ -42,9 +42,9 @@ template void replicate(const MatrixType& m) MatrixType m1 = MatrixType::Random(rows, cols), m2 = MatrixType::Random(rows, cols); - + VectorType v1 = VectorType::Random(rows); - + MatrixX x1, x2; VectorX vx1; @@ -56,17 +56,17 @@ template void replicate(const MatrixType& m) for(int i=0; i())); - + x2.resize(rows,f1); for (int j=0; j