Optimize calls to std::string::find() and friends for a single char.

The character literal overload is more efficient. More info at:

http://clang.llvm.org/extra/clang-tidy/checks/performance-faster-string-find.html
This commit is contained in:
Vincent Rabaud
2020-12-16 16:06:58 +01:00
parent d159417474
commit 8391a23600
3 changed files with 3 additions and 3 deletions

View File

@@ -189,7 +189,7 @@ TEST(Core_OutputArrayCreate, _13772)
TEST(Core_String, find_last_of__with__empty_string)
{
cv::String s;
size_t p = s.find_last_of("q", 0);
size_t p = s.find_last_of('q', 0);
// npos is not exported: EXPECT_EQ(cv::String::npos, p);
EXPECT_EQ(std::string::npos, p);
}