fix compilation adding a makeconst helper struct

This commit is contained in:
Gael Guennebaud 2009-11-07 09:07:23 +01:00
parent 5dc02fe5e9
commit aa0974286f
4 changed files with 25 additions and 18 deletions

View File

@ -350,7 +350,7 @@ struct ei_scalar_multiple_op {
EIGEN_STRONG_INLINE Scalar operator() (const Scalar& a) const { return a * m_other; }
EIGEN_STRONG_INLINE const PacketScalar packetOp(const PacketScalar& a) const
{ return ei_pmul(a, ei_pset1(m_other)); }
const typename NumTraits<Scalar>::Nested m_other;
typename ei_makeconst<typename NumTraits<Scalar>::Nested>::type m_other;
private:
ei_scalar_multiple_op& operator=(const ei_scalar_multiple_op&);
};
@ -364,7 +364,7 @@ struct ei_scalar_multiple2_op {
EIGEN_STRONG_INLINE ei_scalar_multiple2_op(const ei_scalar_multiple2_op& other) : m_other(other.m_other) { }
EIGEN_STRONG_INLINE ei_scalar_multiple2_op(const Scalar2& other) : m_other(other) { }
EIGEN_STRONG_INLINE result_type operator() (const Scalar1& a) const { return a * m_other; }
const typename NumTraits<Scalar2>::Nested m_other;
typename ei_makeconst<typename NumTraits<Scalar2>::Nested>::type m_other;
};
template<typename Scalar1,typename Scalar2>
struct ei_functor_traits<ei_scalar_multiple2_op<Scalar1,Scalar2> >
@ -393,7 +393,7 @@ struct ei_scalar_quotient1_impl<Scalar,false> {
EIGEN_STRONG_INLINE ei_scalar_quotient1_impl(const ei_scalar_quotient1_impl& other) : m_other(other.m_other) { }
EIGEN_STRONG_INLINE ei_scalar_quotient1_impl(const Scalar& other) : m_other(other) {}
EIGEN_STRONG_INLINE Scalar operator() (const Scalar& a) const { return a / m_other; }
const typename NumTraits<Scalar>::Nested m_other;
typename ei_makeconst<typename NumTraits<Scalar>::Nested>::type m_other;
};
template<typename Scalar>
struct ei_functor_traits<ei_scalar_quotient1_impl<Scalar,false> >

View File

@ -64,6 +64,13 @@ template<typename T> struct ei_cleantype<T&> { typedef typename ei_cleant
template<typename T> struct ei_cleantype<const T*> { typedef typename ei_cleantype<T>::type type; };
template<typename T> struct ei_cleantype<T*> { typedef typename ei_cleantype<T>::type type; };
template<typename T> struct ei_makeconst { typedef const T type; };
template<typename T> struct ei_makeconst<const T> { typedef const T type; };
template<typename T> struct ei_makeconst<T&> { typedef const T& type; };
template<typename T> struct ei_makeconst<const T&> { typedef const T& type; };
template<typename T> struct ei_makeconst<T*> { typedef const T* type; };
template<typename T> struct ei_makeconst<const T*> { typedef const T* type; };
/** \internal Allows to enable/disable an overload
* according to a compile time condition.
*/