mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-23 14:53:13 +08:00
Get rid of custom implementation of equal_to and not_equal_no. No longer needed with c+14.
This commit is contained in:
parent
e256ad1823
commit
e4f58816d9
@ -13,29 +13,6 @@
|
|||||||
#include "../InternalHeaderCheck.h"
|
#include "../InternalHeaderCheck.h"
|
||||||
|
|
||||||
namespace Eigen {
|
namespace Eigen {
|
||||||
|
|
||||||
// Portable replacements for certain functors.
|
|
||||||
namespace numext {
|
|
||||||
|
|
||||||
template<typename T = void>
|
|
||||||
struct equal_to {
|
|
||||||
typedef bool result_type;
|
|
||||||
EIGEN_DEVICE_FUNC bool operator()(const T& lhs, const T& rhs) const {
|
|
||||||
return lhs == rhs;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T = void>
|
|
||||||
struct not_equal_to {
|
|
||||||
typedef bool result_type;
|
|
||||||
EIGEN_DEVICE_FUNC bool operator()(const T& lhs, const T& rhs) const {
|
|
||||||
return lhs != rhs;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
// default functor traits for STL functors:
|
// default functor traits for STL functors:
|
||||||
@ -92,18 +69,10 @@ template<typename T>
|
|||||||
struct functor_traits<std::equal_to<T> >
|
struct functor_traits<std::equal_to<T> >
|
||||||
{ enum { Cost = 1, PacketAccess = false }; };
|
{ enum { Cost = 1, PacketAccess = false }; };
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
struct functor_traits<numext::equal_to<T> >
|
|
||||||
: functor_traits<std::equal_to<T> > {};
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct functor_traits<std::not_equal_to<T> >
|
struct functor_traits<std::not_equal_to<T> >
|
||||||
{ enum { Cost = 1, PacketAccess = false }; };
|
{ enum { Cost = 1, PacketAccess = false }; };
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
struct functor_traits<numext::not_equal_to<T> >
|
|
||||||
: functor_traits<std::not_equal_to<T> > {};
|
|
||||||
|
|
||||||
#if (EIGEN_COMP_CXXVER < 17)
|
#if (EIGEN_COMP_CXXVER < 17)
|
||||||
// std::unary_negate is deprecated since c++17 and will be removed in c++20
|
// std::unary_negate is deprecated since c++17 and will be removed in c++20
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -39,10 +39,10 @@ cwiseProduct(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
|
|||||||
*/
|
*/
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
inline const CwiseBinaryOp<numext::equal_to<Scalar>, const Derived, const OtherDerived>
|
inline const CwiseBinaryOp<std::equal_to<Scalar>, const Derived, const OtherDerived>
|
||||||
cwiseEqual(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
|
cwiseEqual(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
|
||||||
{
|
{
|
||||||
return CwiseBinaryOp<numext::equal_to<Scalar>, const Derived, const OtherDerived>(derived(), other.derived());
|
return CwiseBinaryOp<std::equal_to<Scalar>, const Derived, const OtherDerived>(derived(), other.derived());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \returns an expression of the coefficient-wise != operator of *this and \a other
|
/** \returns an expression of the coefficient-wise != operator of *this and \a other
|
||||||
@ -59,10 +59,10 @@ cwiseEqual(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
|
|||||||
*/
|
*/
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
inline const CwiseBinaryOp<numext::not_equal_to<Scalar>, const Derived, const OtherDerived>
|
inline const CwiseBinaryOp<std::not_equal_to<Scalar>, const Derived, const OtherDerived>
|
||||||
cwiseNotEqual(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
|
cwiseNotEqual(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
|
||||||
{
|
{
|
||||||
return CwiseBinaryOp<numext::not_equal_to<Scalar>, const Derived, const OtherDerived>(derived(), other.derived());
|
return CwiseBinaryOp<std::not_equal_to<Scalar>, const Derived, const OtherDerived>(derived(), other.derived());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \returns an expression of the coefficient-wise min of *this and \a other
|
/** \returns an expression of the coefficient-wise min of *this and \a other
|
||||||
|
Loading…
x
Reference in New Issue
Block a user