Reduce allocation of temporary values on heap.

- Use `std::move` while inserting temporary results into vectors.
- Change `push_back` to `emplace_back` where appropriate.
This commit is contained in:
Pavel Solodovnikov
2018-01-25 16:59:33 +03:00
parent fa3ac83af0
commit c85bb007df
69 changed files with 303 additions and 315 deletions

View File

@@ -1320,7 +1320,7 @@ bool cmFileCopier::CheckValue(std::string const& arg)
std::string regex = "/";
regex += cmsys::Glob::PatternToRegex(arg, false);
regex += "$";
this->MatchRules.push_back(MatchRule(regex));
this->MatchRules.emplace_back(regex);
this->CurrentMatchRule = &*(this->MatchRules.end() - 1);
if (this->CurrentMatchRule->Regex.is_valid()) {
this->Doing = DoingNone;
@@ -1332,7 +1332,7 @@ bool cmFileCopier::CheckValue(std::string const& arg)
}
} break;
case DoingRegex:
this->MatchRules.push_back(MatchRule(arg));
this->MatchRules.emplace_back(arg);
this->CurrentMatchRule = &*(this->MatchRules.end() - 1);
if (this->CurrentMatchRule->Regex.is_valid()) {
this->Doing = DoingNone;