diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h index fc00c356..6b264d69 100644 --- a/googlemock/include/gmock/gmock-matchers.h +++ b/googlemock/include/gmock/gmock-matchers.h @@ -257,6 +257,7 @@ #include #include +#include #include #include #include @@ -1199,27 +1200,27 @@ class PairMatchBase { }; }; -class Eq2Matcher : public PairMatchBase { +class Eq2Matcher : public PairMatchBase> { public: static const char* Desc() { return "an equal pair"; } }; -class Ne2Matcher : public PairMatchBase { +class Ne2Matcher : public PairMatchBase> { public: static const char* Desc() { return "an unequal pair"; } }; -class Lt2Matcher : public PairMatchBase { +class Lt2Matcher : public PairMatchBase> { public: static const char* Desc() { return "a pair where the first < the second"; } }; -class Gt2Matcher : public PairMatchBase { +class Gt2Matcher : public PairMatchBase> { public: static const char* Desc() { return "a pair where the first > the second"; } }; -class Le2Matcher : public PairMatchBase { +class Le2Matcher : public PairMatchBase> { public: static const char* Desc() { return "a pair where the first <= the second"; } }; -class Ge2Matcher : public PairMatchBase { +class Ge2Matcher : public PairMatchBase> { public: static const char* Desc() { return "a pair where the first >= the second"; } }; diff --git a/googletest/include/gtest/gtest-matchers.h b/googletest/include/gtest/gtest-matchers.h index 4a60b0d0..d73d8341 100644 --- a/googletest/include/gtest/gtest-matchers.h +++ b/googletest/include/gtest/gtest-matchers.h @@ -40,6 +40,7 @@ #define GOOGLETEST_INCLUDE_GTEST_GTEST_MATCHERS_H_ #include +#include #include #include #include @@ -178,43 +179,6 @@ class MatcherInterface : public MatcherDescriberInterface { namespace internal { -struct AnyEq { - template - bool operator()(const A& a, const B& b) const { - return a == b; - } -}; -struct AnyNe { - template - bool operator()(const A& a, const B& b) const { - return a != b; - } -}; -struct AnyLt { - template - bool operator()(const A& a, const B& b) const { - return a < b; - } -}; -struct AnyGt { - template - bool operator()(const A& a, const B& b) const { - return a > b; - } -}; -struct AnyLe { - template - bool operator()(const A& a, const B& b) const { - return a <= b; - } -}; -struct AnyGe { - template - bool operator()(const A& a, const B& b) const { - return a >= b; - } -}; - // A match result listener that ignores the explanation. class DummyMatchResultListener : public MatchResultListener { public: @@ -758,50 +722,53 @@ class ComparisonBase { }; template -class EqMatcher : public ComparisonBase, Rhs, AnyEq> { +class EqMatcher : public ComparisonBase, Rhs, std::equal_to<>> { public: explicit EqMatcher(const Rhs& rhs) - : ComparisonBase, Rhs, AnyEq>(rhs) {} + : ComparisonBase, Rhs, std::equal_to<>>(rhs) {} static const char* Desc() { return "is equal to"; } static const char* NegatedDesc() { return "isn't equal to"; } }; template -class NeMatcher : public ComparisonBase, Rhs, AnyNe> { +class NeMatcher + : public ComparisonBase, Rhs, std::not_equal_to<>> { public: explicit NeMatcher(const Rhs& rhs) - : ComparisonBase, Rhs, AnyNe>(rhs) {} + : ComparisonBase, Rhs, std::not_equal_to<>>(rhs) {} static const char* Desc() { return "isn't equal to"; } static const char* NegatedDesc() { return "is equal to"; } }; template -class LtMatcher : public ComparisonBase, Rhs, AnyLt> { +class LtMatcher : public ComparisonBase, Rhs, std::less<>> { public: explicit LtMatcher(const Rhs& rhs) - : ComparisonBase, Rhs, AnyLt>(rhs) {} + : ComparisonBase, Rhs, std::less<>>(rhs) {} static const char* Desc() { return "is <"; } static const char* NegatedDesc() { return "isn't <"; } }; template -class GtMatcher : public ComparisonBase, Rhs, AnyGt> { +class GtMatcher : public ComparisonBase, Rhs, std::greater<>> { public: explicit GtMatcher(const Rhs& rhs) - : ComparisonBase, Rhs, AnyGt>(rhs) {} + : ComparisonBase, Rhs, std::greater<>>(rhs) {} static const char* Desc() { return "is >"; } static const char* NegatedDesc() { return "isn't >"; } }; template -class LeMatcher : public ComparisonBase, Rhs, AnyLe> { +class LeMatcher + : public ComparisonBase, Rhs, std::less_equal<>> { public: explicit LeMatcher(const Rhs& rhs) - : ComparisonBase, Rhs, AnyLe>(rhs) {} + : ComparisonBase, Rhs, std::less_equal<>>(rhs) {} static const char* Desc() { return "is <="; } static const char* NegatedDesc() { return "isn't <="; } }; template -class GeMatcher : public ComparisonBase, Rhs, AnyGe> { +class GeMatcher + : public ComparisonBase, Rhs, std::greater_equal<>> { public: explicit GeMatcher(const Rhs& rhs) - : ComparisonBase, Rhs, AnyGe>(rhs) {} + : ComparisonBase, Rhs, std::greater_equal<>>(rhs) {} static const char* Desc() { return "is >="; } static const char* NegatedDesc() { return "isn't >="; } };