Fix ambiguous instanciation using clean class-level SFINAE in product_evaluator

This commit is contained in:
Gael Guennebaud 2015-06-19 17:25:13 +02:00
parent 6fc5438205
commit a5a7b68b76
2 changed files with 7 additions and 3 deletions

View File

@ -100,8 +100,8 @@ struct evaluator_traits<Product<Lhs, Rhs, AliasFreeProduct> >
// This is the default evaluator implementation for products:
// It creates a temporary and call generic_product_impl
template<typename Lhs, typename Rhs, int Options, int ProductTag, typename LhsShape, typename RhsShape>
struct product_evaluator<Product<Lhs, Rhs, Options>, ProductTag, LhsShape, RhsShape, typename traits<Lhs>::Scalar,
typename enable_if<(Options==DefaultProduct || Options==AliasFreeProduct),typename traits<Rhs>::Scalar>::type>
struct product_evaluator<Product<Lhs, Rhs, Options>, ProductTag, LhsShape, RhsShape, typename traits<Lhs>::Scalar, typename traits<Rhs>::Scalar,
EnableIf<(Options==DefaultProduct || Options==AliasFreeProduct)> >
: public evaluator<typename Product<Lhs, Rhs, Options>::PlainObject>::type
{
typedef Product<Lhs, Rhs, Options> XprType;

View File

@ -147,6 +147,9 @@ template<typename _Scalar, int Rows=Dynamic, int Cols=Dynamic, int Supers=Dynami
namespace internal {
template<typename Lhs, typename Rhs> struct product_type;
template<bool> struct EnableIf;
/** \internal
* \class product_evaluator
* Products need their own evaluator with more template arguments allowing for
@ -157,7 +160,8 @@ template< typename T,
typename LhsShape = typename evaluator_traits<typename T::Lhs>::Shape,
typename RhsShape = typename evaluator_traits<typename T::Rhs>::Shape,
typename LhsScalar = typename traits<typename T::Lhs>::Scalar,
typename RhsScalar = typename traits<typename T::Rhs>::Scalar
typename RhsScalar = typename traits<typename T::Rhs>::Scalar,
typename = EnableIf<true> // extra template parameter for SFINAE-based specialization
> struct product_evaluator;
}