diff options
author | Abseil Team <absl-team@google.com> | 2019-10-28 16:58:29 (GMT) |
---|---|---|
committer | vslashg <gfalcon@google.com> | 2019-10-29 20:51:31 (GMT) |
commit | 755f853c6be9ff44d6125367fa5ebdb75c382640 (patch) | |
tree | 305f72a420507bd758ca776c1f907e1026d2eb76 /googlemock/include/gmock | |
parent | 757d39a79bcb3194a42ad9279dba5f56e84dda66 (diff) | |
download | googletest-755f853c6be9ff44d6125367fa5ebdb75c382640.zip googletest-755f853c6be9ff44d6125367fa5ebdb75c382640.tar.gz googletest-755f853c6be9ff44d6125367fa5ebdb75c382640.tar.bz2 |
Googletest export
Avoid temporary matcher instances.
They are unnecessary and can be relatively more expensive than the rest of the
algorithm.
PiperOrigin-RevId: 277084853
Diffstat (limited to 'googlemock/include/gmock')
-rw-r--r-- | googlemock/include/gmock/gmock-matchers.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h index bb047da..a964883 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<char> 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)); } } |