cmListCommand: Avoid needlessly erasing from vectors.
The entire vector will be destroyed at once at the end of the scope, and the remove algorithms already give us the end of the range of interesting values, so just use those sentinals.
This commit is contained in:
parent
1c7c35c372
commit
116459d34f
|
@ -357,13 +357,14 @@ bool cmListCommand
|
||||||
|
|
||||||
std::vector<std::string> remove(args.begin() + 2, args.end());
|
std::vector<std::string> remove(args.begin() + 2, args.end());
|
||||||
std::sort(remove.begin(), remove.end());
|
std::sort(remove.begin(), remove.end());
|
||||||
remove.erase(std::unique(remove.begin(), remove.end()), remove.end());
|
std::vector<std::string>::const_iterator remEnd =
|
||||||
|
std::unique(remove.begin(), remove.end());
|
||||||
|
std::vector<std::string>::const_iterator remBegin = remove.begin();
|
||||||
|
|
||||||
varArgsExpanded.erase(
|
std::vector<std::string>::const_iterator argsEnd =
|
||||||
cmRemoveMatching(varArgsExpanded, remove),
|
cmRemoveMatching(varArgsExpanded, cmRange(remBegin, remEnd));
|
||||||
varArgsExpanded.end());
|
std::vector<std::string>::const_iterator argsBegin = varArgsExpanded.begin();
|
||||||
|
std::string value = cmJoin(cmRange(argsBegin, argsEnd), ";");
|
||||||
std::string value = cmJoin(varArgsExpanded, ";");
|
|
||||||
this->Makefile->AddDefinition(listName, value.c_str());
|
this->Makefile->AddDefinition(listName, value.c_str());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -418,9 +419,11 @@ bool cmListCommand
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
varArgsExpanded.erase(cmRemoveDuplicates(varArgsExpanded),
|
std::vector<std::string>::const_iterator argsEnd =
|
||||||
varArgsExpanded.end());
|
cmRemoveDuplicates(varArgsExpanded);
|
||||||
std::string value = cmJoin(varArgsExpanded, ";");
|
std::vector<std::string>::const_iterator argsBegin =
|
||||||
|
varArgsExpanded.begin();
|
||||||
|
std::string value = cmJoin(cmRange(argsBegin, argsEnd), ";");
|
||||||
|
|
||||||
this->Makefile->AddDefinition(listName, value.c_str());
|
this->Makefile->AddDefinition(listName, value.c_str());
|
||||||
return true;
|
return true;
|
||||||
|
@ -503,13 +506,14 @@ bool cmListCommand::HandleRemoveAtCommand(
|
||||||
}
|
}
|
||||||
|
|
||||||
std::sort(removed.begin(), removed.end());
|
std::sort(removed.begin(), removed.end());
|
||||||
removed.erase(std::unique(removed.begin(), removed.end()), removed.end());
|
std::vector<size_t>::const_iterator remEnd =
|
||||||
|
std::unique(removed.begin(), removed.end());
|
||||||
varArgsExpanded.erase(cmRemoveIndices(varArgsExpanded, removed),
|
std::vector<size_t>::const_iterator remBegin = removed.begin();
|
||||||
varArgsExpanded.end());
|
|
||||||
|
|
||||||
std::string value = cmJoin(varArgsExpanded, ";");
|
|
||||||
|
|
||||||
|
std::vector<std::string>::const_iterator argsEnd =
|
||||||
|
cmRemoveIndices(varArgsExpanded, cmRange(remBegin, remEnd));
|
||||||
|
std::vector<std::string>::const_iterator argsBegin = varArgsExpanded.begin();
|
||||||
|
std::string value = cmJoin(cmRange(argsBegin, argsEnd), ";");
|
||||||
|
|
||||||
this->Makefile->AddDefinition(listName, value.c_str());
|
this->Makefile->AddDefinition(listName, value.c_str());
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue