Commit 755f853c by Abseil Team Committed by vslashg

Googletest export

Avoid temporary matcher instances. They are unnecessary and can be relatively more expensive than the rest of the algorithm. PiperOrigin-RevId: 277084853
parent 757d39a7
...@@ -3028,12 +3028,14 @@ class UnorderedElementsAreMatcherImpl ...@@ -3028,12 +3028,14 @@ class UnorderedElementsAreMatcherImpl
element_printouts->clear(); element_printouts->clear();
::std::vector<char> did_match; ::std::vector<char> did_match;
size_t num_elements = 0; size_t num_elements = 0;
DummyMatchResultListener dummy;
for (; elem_first != elem_last; ++num_elements, ++elem_first) { for (; elem_first != elem_last; ++num_elements, ++elem_first) {
if (listener->IsInterested()) { if (listener->IsInterested()) {
element_printouts->push_back(PrintToString(*elem_first)); element_printouts->push_back(PrintToString(*elem_first));
} }
for (size_t irhs = 0; irhs != matchers_.size(); ++irhs) { 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));
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment