[gtest] Drop custom-rolled heterogeneous comparator functors in favor of C++ standard ones

* Standard heterogeneous comparator functors such as `std::equal_to<>` and `std::less<>` [have been available since C++14](https://en.cppreference.com/w/cpp/utility/functional/less_void)
* Now that [C++14 is the minimum supported version of C++ in Googletest](https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md), let's delete these duplications of the standard library

PiperOrigin-RevId: 515743068
Change-Id: I1563a2f94039c3a6688429298555545a922f6d7e
This commit is contained in:
Lawrence Wolf-Sonkin
2023-03-10 14:42:38 -08:00
committed by Copybara-Service
parent 50e07d1c92
commit 038e392ebd
2 changed files with 23 additions and 55 deletions

View File

@@ -257,6 +257,7 @@
#include <algorithm>
#include <cmath>
#include <functional>
#include <initializer_list>
#include <ios>
#include <iterator>
@@ -1199,27 +1200,27 @@ class PairMatchBase {
};
};
class Eq2Matcher : public PairMatchBase<Eq2Matcher, AnyEq> {
class Eq2Matcher : public PairMatchBase<Eq2Matcher, std::equal_to<>> {
public:
static const char* Desc() { return "an equal pair"; }
};
class Ne2Matcher : public PairMatchBase<Ne2Matcher, AnyNe> {
class Ne2Matcher : public PairMatchBase<Ne2Matcher, std::not_equal_to<>> {
public:
static const char* Desc() { return "an unequal pair"; }
};
class Lt2Matcher : public PairMatchBase<Lt2Matcher, AnyLt> {
class Lt2Matcher : public PairMatchBase<Lt2Matcher, std::less<>> {
public:
static const char* Desc() { return "a pair where the first < the second"; }
};
class Gt2Matcher : public PairMatchBase<Gt2Matcher, AnyGt> {
class Gt2Matcher : public PairMatchBase<Gt2Matcher, std::greater<>> {
public:
static const char* Desc() { return "a pair where the first > the second"; }
};
class Le2Matcher : public PairMatchBase<Le2Matcher, AnyLe> {
class Le2Matcher : public PairMatchBase<Le2Matcher, std::less_equal<>> {
public:
static const char* Desc() { return "a pair where the first <= the second"; }
};
class Ge2Matcher : public PairMatchBase<Ge2Matcher, AnyGe> {
class Ge2Matcher : public PairMatchBase<Ge2Matcher, std::greater_equal<>> {
public:
static const char* Desc() { return "a pair where the first >= the second"; }
};