diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorCustomOp.h b/unsupported/Eigen/CXX11/src/Tensor/TensorCustomOp.h index 87d84a311..39410e63d 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorCustomOp.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorCustomOp.h @@ -20,8 +20,8 @@ namespace Eigen { * */ namespace internal { -template -struct traits > +template class MakePointer_> +struct traits > { typedef typename XprType::Scalar Scalar; typedef typename XprType::StorageKind StorageKind; @@ -30,27 +30,35 @@ struct traits > typedef typename remove_reference::type _Nested; static const int NumDimensions = traits::NumDimensions; static const int Layout = traits::Layout; - typedef typename traits::PointerType PointerType; + + template struct MakePointer { + // Intermediate typedef to workaround MSVC issue. + typedef MakePointer_ MakePointerT; + typedef typename MakePointerT::Type Type; + typedef typename MakePointerT::RefType RefType; + typedef typename MakePointerT::ScalarType ScalarType; + }; + typedef typename MakePointer::type>::Type PointerType; }; -template -struct eval, Eigen::Dense> +template class MakePointer_> +struct eval, Eigen::Dense> { - typedef const TensorCustomUnaryOp& type; + typedef const TensorCustomUnaryOp& type; }; -template -struct nested > +template class MakePointer_> +struct nested > { - typedef TensorCustomUnaryOp type; + typedef TensorCustomUnaryOp type; }; } // end namespace internal -template -class TensorCustomUnaryOp : public TensorBase, ReadOnlyAccessors> +template class MakePointer_> +class TensorCustomUnaryOp : public TensorBase, ReadOnlyAccessors> { public: typedef typename internal::traits::Scalar Scalar; @@ -77,10 +85,10 @@ class TensorCustomUnaryOp : public TensorBase -struct TensorEvaluator, Device> +template class MakePointer_, typename Device> +struct TensorEvaluator, Device> { - typedef TensorCustomUnaryOp ArgType; + typedef TensorCustomUnaryOp ArgType; typedef typename internal::traits::Index Index; static const int NumDims = internal::traits::NumDimensions; typedef DSizes Dimensions; @@ -88,7 +96,7 @@ struct TensorEvaluator, Devi typedef typename internal::remove_const::type CoeffReturnType; typedef typename PacketType::type PacketReturnType; static const int PacketSize = PacketType::size; - typedef typename internal::remove_all::PointerType>::type * PointerType; + typedef typename Eigen::internal::traits::PointerType PointerType; enum { IsAligned = false, @@ -112,7 +120,7 @@ struct TensorEvaluator, Devi evalTo(data); return false; } else { - m_result = static_cast( + m_result = static_cast( m_device.allocate_temp(dimensions().TotalSize() * sizeof(Scalar))); evalTo(m_result); return true; @@ -168,8 +176,8 @@ struct TensorEvaluator, Devi * */ namespace internal { -template -struct traits > +template class MakePointer_> +struct traits > { typedef typename internal::promote_storage_type::ret Scalar; @@ -185,28 +193,35 @@ struct traits > typedef typename remove_reference::type _RhsNested; static const int NumDimensions = traits::NumDimensions; static const int Layout = traits::Layout; - typedef typename conditional::val, - typename traits::PointerType, typename traits::PointerType>::type PointerType; + + template struct MakePointer { + // Intermediate typedef to workaround MSVC issue. + typedef MakePointer_ MakePointerT; + typedef typename MakePointerT::Type Type; + typedef typename MakePointerT::RefType RefType; + typedef typename MakePointerT::ScalarType ScalarType; + }; + typedef typename MakePointer::Type PointerType; }; -template -struct eval, Eigen::Dense> +template class MakePointer_> +struct eval, Eigen::Dense> { typedef const TensorCustomBinaryOp& type; }; -template -struct nested > +template class MakePointer_> +struct nested > { - typedef TensorCustomBinaryOp type; + typedef TensorCustomBinaryOp type; }; } // end namespace internal -template -class TensorCustomBinaryOp : public TensorBase, ReadOnlyAccessors> +template class MakePointer_> +class TensorCustomBinaryOp : public TensorBase, ReadOnlyAccessors> { public: typedef typename internal::traits::Scalar Scalar; @@ -239,10 +254,10 @@ class TensorCustomBinaryOp : public TensorBase -struct TensorEvaluator, Device> +template class MakePointer_, typename Device> +struct TensorEvaluator, Device> { - typedef TensorCustomBinaryOp XprType; + typedef TensorCustomBinaryOp XprType; typedef typename internal::traits::Index Index; static const int NumDims = internal::traits::NumDimensions; typedef DSizes Dimensions; @@ -250,7 +265,7 @@ struct TensorEvaluator::type CoeffReturnType; typedef typename PacketType::type PacketReturnType; static const int PacketSize = PacketType::size; - typedef typename internal::remove_all::PointerType>::type * PointerType; + typedef typename Eigen::internal::traits::PointerType PointerType; enum { IsAligned = false, diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorForwardDeclarations.h b/unsupported/Eigen/CXX11/src/Tensor/TensorForwardDeclarations.h index 0dd524a30..da0751039 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorForwardDeclarations.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorForwardDeclarations.h @@ -89,8 +89,8 @@ template class TensorAssignOp; template class TensorScanOp; template class TensorTraceOp; -template class TensorCustomUnaryOp; -template class TensorCustomBinaryOp; +template class MakePointer_ = MakePointer> class TensorCustomUnaryOp; +template class MakePointer_ = MakePointer> class TensorCustomBinaryOp; template class MakePointer_ = MakePointer> class TensorEvalToOp; template class TensorForcedEvalOp;