From 80d5177ddf403aa153c3ed9fe3e7f58b241257fb Mon Sep 17 00:00:00 2001 From: ppenguin Date: Mon, 25 May 2020 14:25:16 +0800 Subject: [PATCH] Use count function instead of handwritten loop --- googletest/src/gtest-typed-test.cc | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/googletest/src/gtest-typed-test.cc b/googletest/src/gtest-typed-test.cc index 1b1cfb0d..722c7b14 100644 --- a/googletest/src/gtest-typed-test.cc +++ b/googletest/src/gtest-typed-test.cc @@ -78,17 +78,7 @@ const char* TypedTestSuitePState::VerifyRegisteredTestNames( continue; } - bool found = false; - for (RegisteredTestIter it = registered_tests_.begin(); - it != registered_tests_.end(); - ++it) { - if (name == it->first) { - found = true; - break; - } - } - - if (found) { + if (registered_tests_.count(name) != 0) { tests.insert(name); } else { errors << "No test named " << name