1
0
mirror of https://github.com/opencv/opencv_contrib.git synced 2025-10-19 02:16:34 +08:00

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:19:55 +01:00
parent 332ae5b3b5
commit f10f4a64f7

View File

@@ -65,8 +65,8 @@ Ptr<TrackerFeature> TrackerFeature::create( const String& trackerFeatureType )
{
if( trackerFeatureType.find( "FEATURE2D" ) == 0 )
{
size_t firstSep = trackerFeatureType.find_first_of( "." );
size_t secondSep = trackerFeatureType.find_last_of( "." );
size_t firstSep = trackerFeatureType.find_first_of('.');
size_t secondSep = trackerFeatureType.find_last_of('.');
String detector = trackerFeatureType.substr( firstSep, secondSep - firstSep );
String descriptor = trackerFeatureType.substr( secondSep, trackerFeatureType.length() - secondSep );