diff options
author | Lawrence Wolf-Sonkin <lawrencews@google.com> | 2023-03-10 22:42:38 (GMT) |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-03-10 22:43:13 (GMT) |
commit | 038e392ebd8081c756e180475cc361f711fb438d (patch) | |
tree | 9ccb98f6b3cec7ef026b26a72ebdfba5e53c00b6 /googlemock/include | |
parent | 50e07d1c92875e66138d5d5ee3bb46ef237115bb (diff) | |
download | googletest-038e392ebd8081c756e180475cc361f711fb438d.zip googletest-038e392ebd8081c756e180475cc361f711fb438d.tar.gz googletest-038e392ebd8081c756e180475cc361f711fb438d.tar.bz2 |
[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
Diffstat (limited to 'googlemock/include')
-rw-r--r-- | googlemock/include/gmock/gmock-matchers.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h index fc00c35..6b264d6 100644 --- a/googlemock/include/gmock/gmock-matchers.h +++ b/googlemock/include/gmock/gmock-matchers.h @@ -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"; } }; |