Get rid of custom implementation of equal_to and not_equal_no. No longer needed with c+14.

This commit is contained in:
Rasmus Munk Larsen 2023-02-07 21:36:44 -08:00
parent e256ad1823
commit e4f58816d9
2 changed files with 4 additions and 35 deletions

View File

@ -13,29 +13,6 @@
#include "../InternalHeaderCheck.h"
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 {
// default functor traits for STL functors:
@ -92,18 +69,10 @@ template<typename T>
struct functor_traits<std::equal_to<T> >
{ enum { Cost = 1, PacketAccess = false }; };
template<typename T>
struct functor_traits<numext::equal_to<T> >
: functor_traits<std::equal_to<T> > {};
template<typename T>
struct functor_traits<std::not_equal_to<T> >
{ 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)
// std::unary_negate is deprecated since c++17 and will be removed in c++20
template<typename T>

View File

@ -39,10 +39,10 @@ cwiseProduct(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
*/
template<typename OtherDerived>
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
{
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
@ -59,10 +59,10 @@ cwiseEqual(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
*/
template<typename OtherDerived>
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
{
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