mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-23 01:59:38 +08:00
Postfixed add_const and remove_const by _on_value_type to express the differences to the STL.
This commit is contained in:
parent
139392488d
commit
bf9d25ce58
@ -137,7 +137,7 @@ MatrixBase<Derived>::forceAlignedAccess()
|
||||
*/
|
||||
template<typename Derived>
|
||||
template<bool Enable>
|
||||
inline typename internal::add_const<typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type>::type
|
||||
inline typename internal::add_const_on_value_type<typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type>::type
|
||||
MatrixBase<Derived>::forceAlignedAccessIf() const
|
||||
{
|
||||
return derived();
|
||||
|
@ -419,7 +419,7 @@ struct scalar_multiple_op {
|
||||
EIGEN_STRONG_INLINE Scalar operator() (const Scalar& a) const { return a * m_other; }
|
||||
EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const
|
||||
{ return internal::pmul(a, pset1<Packet>(m_other)); }
|
||||
typename add_const<typename NumTraits<Scalar>::Nested>::type m_other;
|
||||
typename add_const_on_value_type<typename NumTraits<Scalar>::Nested>::type m_other;
|
||||
};
|
||||
template<typename Scalar>
|
||||
struct functor_traits<scalar_multiple_op<Scalar> >
|
||||
@ -431,7 +431,7 @@ struct scalar_multiple2_op {
|
||||
EIGEN_STRONG_INLINE scalar_multiple2_op(const scalar_multiple2_op& other) : m_other(other.m_other) { }
|
||||
EIGEN_STRONG_INLINE scalar_multiple2_op(const Scalar2& other) : m_other(other) { }
|
||||
EIGEN_STRONG_INLINE result_type operator() (const Scalar1& a) const { return a * m_other; }
|
||||
typename add_const<typename NumTraits<Scalar2>::Nested>::type m_other;
|
||||
typename add_const_on_value_type<typename NumTraits<Scalar2>::Nested>::type m_other;
|
||||
};
|
||||
template<typename Scalar1,typename Scalar2>
|
||||
struct functor_traits<scalar_multiple2_op<Scalar1,Scalar2> >
|
||||
@ -458,7 +458,7 @@ struct scalar_quotient1_impl<Scalar,true> {
|
||||
EIGEN_STRONG_INLINE scalar_quotient1_impl(const scalar_quotient1_impl& other) : m_other(other.m_other) { }
|
||||
EIGEN_STRONG_INLINE scalar_quotient1_impl(const Scalar& other) : m_other(other) {}
|
||||
EIGEN_STRONG_INLINE Scalar operator() (const Scalar& a) const { return a / m_other; }
|
||||
typename add_const<typename NumTraits<Scalar>::Nested>::type m_other;
|
||||
typename add_const_on_value_type<typename NumTraits<Scalar>::Nested>::type m_other;
|
||||
};
|
||||
template<typename Scalar>
|
||||
struct functor_traits<scalar_quotient1_impl<Scalar,true> >
|
||||
|
@ -163,7 +163,7 @@ struct real_ref_retval
|
||||
};
|
||||
|
||||
template<typename Scalar>
|
||||
inline typename add_const< EIGEN_MATHFUNC_RETVAL(real_ref, Scalar) >::type real_ref(const Scalar& x)
|
||||
inline typename add_const_on_value_type< EIGEN_MATHFUNC_RETVAL(real_ref, Scalar) >::type real_ref(const Scalar& x)
|
||||
{
|
||||
return real_ref_impl<Scalar>::run(x);
|
||||
}
|
||||
@ -215,7 +215,7 @@ struct imag_ref_retval
|
||||
};
|
||||
|
||||
template<typename Scalar>
|
||||
inline typename add_const< EIGEN_MATHFUNC_RETVAL(imag_ref, Scalar) >::type imag_ref(const Scalar& x)
|
||||
inline typename add_const_on_value_type< EIGEN_MATHFUNC_RETVAL(imag_ref, Scalar) >::type imag_ref(const Scalar& x)
|
||||
{
|
||||
return imag_ref_impl<Scalar>::run(x);
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ template<typename Derived> class MatrixBase
|
||||
|
||||
inline const ForceAlignedAccess<Derived> forceAlignedAccess() const;
|
||||
inline ForceAlignedAccess<Derived> forceAlignedAccess();
|
||||
template<bool Enable> inline typename internal::add_const<typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type>::type forceAlignedAccessIf() const;
|
||||
template<bool Enable> inline typename internal::add_const_on_value_type<typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type>::type forceAlignedAccessIf() const;
|
||||
template<bool Enable> inline typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type forceAlignedAccessIf();
|
||||
|
||||
Scalar trace() const;
|
||||
|
@ -54,10 +54,10 @@ template<typename T> struct remove_pointer { typedef T type; };
|
||||
template<typename T> struct remove_pointer<T*> { typedef T type; };
|
||||
template<typename T> struct remove_pointer<T*const> { typedef T type; };
|
||||
|
||||
template<typename T> struct remove_const { typedef T type; };
|
||||
template<typename T> struct remove_const<const T> { typedef T type; };
|
||||
template<typename T> struct remove_const<T const &> { typedef T & type; };
|
||||
template<typename T> struct remove_const<T const *> { typedef T * type; };
|
||||
template<typename T> struct remove_const_on_value_type { typedef T type; };
|
||||
template<typename T> struct remove_const_on_value_type<const T> { typedef T type; };
|
||||
template<typename T> struct remove_const_on_value_type<T const &> { typedef T & type; };
|
||||
template<typename T> struct remove_const_on_value_type<T const *> { typedef T * type; };
|
||||
|
||||
template<typename T> struct remove_all { typedef T type; };
|
||||
template<typename T> struct remove_all<const T> { typedef typename remove_all<T>::type type; };
|
||||
@ -83,16 +83,16 @@ template<> struct is_arithmetic<unsigned long> { enum { value = true }; };
|
||||
template<> struct is_arithmetic<signed long long> { enum { value = true }; };
|
||||
template<> struct is_arithmetic<unsigned long long> { enum { value = true }; };
|
||||
|
||||
template<typename T> struct add_const { typedef const T type; };
|
||||
template<typename T> struct add_const<const T> { typedef const T type; };
|
||||
template<typename T> struct add_const<T&> { typedef const T& type; };
|
||||
template<typename T> struct add_const<const T&> { typedef const T& type; };
|
||||
template<typename T> struct add_const<T*> { typedef const T* type; };
|
||||
template<typename T> struct add_const<const T*> { typedef const T* type; };
|
||||
template<typename T> struct add_const_on_value_type { typedef const T type; };
|
||||
template<typename T> struct add_const_on_value_type<const T> { typedef const T type; };
|
||||
template<typename T> struct add_const_on_value_type<T&> { typedef const T& type; };
|
||||
template<typename T> struct add_const_on_value_type<const T&> { typedef const T& type; };
|
||||
template<typename T> struct add_const_on_value_type<T*> { typedef const T* type; };
|
||||
template<typename T> struct add_const_on_value_type<const T*> { typedef const T* type; };
|
||||
|
||||
template<typename T> struct makeconst_return_type
|
||||
{
|
||||
typedef typename conditional<is_arithmetic<T>::value, T, typename add_const<T>::type>::type type;
|
||||
typedef typename conditional<is_arithmetic<T>::value, T, typename add_const_on_value_type<T>::type>::type type;
|
||||
};
|
||||
|
||||
/** \internal Allows to enable/disable an overload
|
||||
|
@ -43,11 +43,11 @@ void test_meta()
|
||||
VERIFY(( internal::is_same<float,internal::remove_all<float* const *&>::type >::value));
|
||||
VERIFY(( internal::is_same<float,internal::remove_all<float* const>::type >::value));
|
||||
|
||||
VERIFY(( internal::is_same<float*,internal::remove_const<const float*>::type >::value));
|
||||
VERIFY(( internal::is_same<float&,internal::remove_const<const float&>::type >::value));
|
||||
VERIFY(( internal::is_same<float&,internal::remove_const<ConstFloatRef>::type >::value));
|
||||
VERIFY(( internal::is_same<float*,internal::remove_const_on_value_type<const float*>::type >::value));
|
||||
VERIFY(( internal::is_same<float&,internal::remove_const_on_value_type<const float&>::type >::value));
|
||||
VERIFY(( internal::is_same<float&,internal::remove_const_on_value_type<ConstFloatRef>::type >::value));
|
||||
|
||||
VERIFY(( internal::is_same<float&,internal::remove_const<float&>::type >::value));
|
||||
VERIFY(( internal::is_same<float&,internal::remove_const_on_value_type<float&>::type >::value));
|
||||
VERIFY(( internal::is_same<float,internal::remove_reference<float&>::type >::value));
|
||||
VERIFY(( internal::is_same<const float,internal::remove_reference<const float&>::type >::value));
|
||||
VERIFY(( internal::is_same<float,internal::remove_pointer<float*>::type >::value));
|
||||
|
Loading…
x
Reference in New Issue
Block a user