From e33fe91b1a15ce695fc7fb5d0215293295f9a720 Mon Sep 17 00:00:00 2001 From: Martin Ettl Date: Fri, 5 Jan 2018 22:24:28 +0100 Subject: [PATCH] Micro optimize std::string::find() calls searching for a single space. --- lib/templatesimplifier.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp index c098190ff..8fa5690f1 100644 --- a/lib/templatesimplifier.cpp +++ b/lib/templatesimplifier.cpp @@ -793,7 +793,7 @@ void TemplateSimplifier::simplifyTemplateAliases(std::liststr(templateAlias.token->str()); } else { tok2 = Tokenizer::copyTokens(aliasUsage.token, aliasToken1, templateAlias.token, true); @@ -987,7 +987,7 @@ void TemplateSimplifier::expandTemplate( std::stack brackets; // holds "(", "[" and "{" tokens // FIXME use full name matching somehow - const std::string lastName = (fullName.find(" ") != std::string::npos) ? fullName.substr(fullName.rfind(" ")+1) : fullName; + const std::string lastName = (fullName.find(' ') != std::string::npos) ? fullName.substr(fullName.rfind(' ')+1) : fullName; for (; tok3; tok3 = tok3->next()) { if (tok3->isName()) { @@ -1639,7 +1639,7 @@ void TemplateSimplifier::replaceTemplateUsage(Token * const instantiationToken, continue; // FIXME Proper name matching - const std::string lastName(templateName.find(" ") == std::string::npos ? templateName : templateName.substr(templateName.rfind(" ") + 1)); + const std::string lastName(templateName.find(' ') == std::string::npos ? templateName : templateName.substr(templateName.rfind(' ') + 1)); if (lastName != nameTok->str()) continue;