From 755f853c6be9ff44d6125367fa5ebdb75c382640 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Mon, 28 Oct 2019 12:58:29 -0400 Subject: Googletest export Avoid temporary matcher instances. They are unnecessary and can be relatively more expensive than the rest of the algorithm. PiperOrigin-RevId: 277084853 --- googlemock/include/gmock/gmock-matchers.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'googlemock') diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h index bb047da9..a9648835 100644 --- a/googlemock/include/gmock/gmock-matchers.h +++ b/googlemock/include/gmock/gmock-matchers.h @@ -3028,12 +3028,14 @@ class UnorderedElementsAreMatcherImpl element_printouts->clear(); ::std::vector did_match; size_t num_elements = 0; + DummyMatchResultListener dummy; for (; elem_first != elem_last; ++num_elements, ++elem_first) { if (listener->IsInterested()) { element_printouts->push_back(PrintToString(*elem_first)); } for (size_t irhs = 0; irhs != matchers_.size(); ++irhs) { - did_match.push_back(Matches(matchers_[irhs])(*elem_first)); + did_match.push_back( + matchers_[irhs].MatchAndExplain(*elem_first, &dummy)); } } -- cgit v1.2.3