Use insert instead of a loop in some cases.
Limit this change to inserting into a vector from a vector. A follow up change can use insert for inserting into a set.
This commit is contained in:
parent
2f7ef7e38d
commit
238dd2fbab
|
@ -1094,11 +1094,8 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, int length,
|
|||
{
|
||||
// Create a contiguous array for the line
|
||||
this->CurrentProcessingLine.clear();
|
||||
t_BuildProcessingQueueType::iterator cit;
|
||||
for ( cit = queue->begin(); cit != it; ++cit )
|
||||
{
|
||||
this->CurrentProcessingLine.push_back(*cit);
|
||||
}
|
||||
this->CurrentProcessingLine.insert(this->CurrentProcessingLine.end(),
|
||||
queue->begin(), queue->end());
|
||||
this->CurrentProcessingLine.push_back(0);
|
||||
const char* line = &*this->CurrentProcessingLine.begin();
|
||||
|
||||
|
|
|
@ -526,11 +526,8 @@ void cmCTestMultiProcessHandler::CreateParallelTestCostList()
|
|||
|
||||
TestList sortedCopy;
|
||||
|
||||
for(TestSet::const_iterator j = currentSet.begin();
|
||||
j != currentSet.end(); ++j)
|
||||
{
|
||||
sortedCopy.push_back(*j);
|
||||
}
|
||||
sortedCopy.insert(sortedCopy.end(),
|
||||
currentSet.begin(), currentSet.end());
|
||||
|
||||
std::stable_sort(sortedCopy.begin(), sortedCopy.end(), comp);
|
||||
|
||||
|
|
|
@ -349,11 +349,7 @@ void cmCTestP4::SetP4Options(std::vector<char const*> &CommandOptions)
|
|||
std::vector<std::string> args =
|
||||
cmSystemTools::ParseArguments(opts.c_str());
|
||||
|
||||
for(std::vector<std::string>::const_iterator ai = args.begin();
|
||||
ai != args.end(); ++ai)
|
||||
{
|
||||
P4Options.push_back(*ai);
|
||||
}
|
||||
P4Options.insert(P4Options.end(), args.begin(), args.end());
|
||||
}
|
||||
|
||||
CommandOptions.clear();
|
||||
|
|
|
@ -74,13 +74,8 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
|
|||
std::vector<std::string> notesFiles;
|
||||
cmCTest::VectorOfStrings newNotesFiles;
|
||||
cmSystemTools::ExpandListArgument(notesFilesVariable,notesFiles);
|
||||
std::vector<std::string>::iterator it;
|
||||
for ( it = notesFiles.begin();
|
||||
it != notesFiles.end();
|
||||
++ it )
|
||||
{
|
||||
newNotesFiles.push_back(*it);
|
||||
}
|
||||
newNotesFiles.insert(newNotesFiles.end(),
|
||||
notesFiles.begin(), notesFiles.end());
|
||||
this->CTest->GenerateNotesFile(newNotesFiles);
|
||||
}
|
||||
|
||||
|
@ -91,13 +86,8 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
|
|||
std::vector<std::string> extraFiles;
|
||||
cmCTest::VectorOfStrings newExtraFiles;
|
||||
cmSystemTools::ExpandListArgument(extraFilesVariable,extraFiles);
|
||||
std::vector<std::string>::iterator it;
|
||||
for ( it = extraFiles.begin();
|
||||
it != extraFiles.end();
|
||||
++ it )
|
||||
{
|
||||
newExtraFiles.push_back(*it);
|
||||
}
|
||||
newExtraFiles.insert(newExtraFiles.end(),
|
||||
extraFiles.begin(), extraFiles.end());
|
||||
if ( !this->CTest->SubmitExtraFiles(newExtraFiles))
|
||||
{
|
||||
this->SetError("problem submitting extra files.");
|
||||
|
|
|
@ -36,11 +36,7 @@ bool cmAddTestCommand
|
|||
|
||||
// Collect the command with arguments.
|
||||
std::vector<std::string> command;
|
||||
for(std::vector<std::string>::const_iterator it = args.begin() + 1;
|
||||
it != args.end(); ++it)
|
||||
{
|
||||
command.push_back(*it);
|
||||
}
|
||||
command.insert(command.end(), args.begin() + 1, args.end());
|
||||
|
||||
// Create the test but add a generator only the first time it is
|
||||
// seen. This preserves behavior from before test generators.
|
||||
|
|
|
@ -53,10 +53,7 @@ bool cmConditionEvaluator::IsTrue(
|
|||
cmArgumentList newArgs;
|
||||
|
||||
// copy to the list structure
|
||||
for(unsigned int i = 0; i < args.size(); ++i)
|
||||
{
|
||||
newArgs.push_back(args[i]);
|
||||
}
|
||||
newArgs.insert(newArgs.end(), args.begin(), args.end());
|
||||
|
||||
// now loop through the arguments and see if we can reduce any of them
|
||||
// we do this multiple times. Once for each level of precedence
|
||||
|
@ -411,10 +408,7 @@ bool cmConditionEvaluator::HandleLevel0(cmArgumentList &newArgs,
|
|||
// copy to the list structure
|
||||
cmArgumentList::iterator argP1 = arg;
|
||||
argP1++;
|
||||
for(; argP1 != argClose; argP1++)
|
||||
{
|
||||
newArgs2.push_back(*argP1);
|
||||
}
|
||||
newArgs2.insert(newArgs2.end(), argP1, argClose);
|
||||
newArgs2.pop_back();
|
||||
// now recursively invoke IsTrue to handle the values inside the
|
||||
// parenthetical expression
|
||||
|
|
|
@ -131,21 +131,14 @@ const char* cmCustomCommand::GetComment() const
|
|||
//----------------------------------------------------------------------------
|
||||
void cmCustomCommand::AppendCommands(const cmCustomCommandLines& commandLines)
|
||||
{
|
||||
for(cmCustomCommandLines::const_iterator i=commandLines.begin();
|
||||
i != commandLines.end(); ++i)
|
||||
{
|
||||
this->CommandLines.push_back(*i);
|
||||
}
|
||||
this->CommandLines.insert(this->CommandLines.end(),
|
||||
commandLines.begin(), commandLines.end());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmCustomCommand::AppendDepends(const std::vector<std::string>& depends)
|
||||
{
|
||||
for(std::vector<std::string>::const_iterator i=depends.begin();
|
||||
i != depends.end(); ++i)
|
||||
{
|
||||
this->Depends.push_back(*i);
|
||||
}
|
||||
this->Depends.insert(this->Depends.end(), depends.begin(), depends.end());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
|
@ -184,10 +184,8 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn)
|
|||
std::vector<std::string> shortArgs = this->Names;
|
||||
this->Names.clear(); // clear out any values in Names
|
||||
this->Names.push_back(shortArgs[0]);
|
||||
for(unsigned int j = 1; j < shortArgs.size(); ++j)
|
||||
{
|
||||
this->UserGuessArgs.push_back(shortArgs[j]);
|
||||
}
|
||||
this->UserGuessArgs.insert(this->UserGuessArgs.end(),
|
||||
shortArgs.begin() + 1, shortArgs.end());
|
||||
}
|
||||
this->ExpandPaths();
|
||||
|
||||
|
|
|
@ -271,11 +271,7 @@ bool cmFunctionCommand
|
|||
|
||||
// create a function blocker
|
||||
cmFunctionFunctionBlocker *f = new cmFunctionFunctionBlocker();
|
||||
for(std::vector<std::string>::const_iterator j = args.begin();
|
||||
j != args.end(); ++j)
|
||||
{
|
||||
f->Args.push_back(*j);
|
||||
}
|
||||
f->Args.insert(f->Args.end(), args.begin(), args.end());
|
||||
this->Makefile->AddFunctionBlocker(f);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -489,11 +489,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir,
|
|||
unique.insert(*li);
|
||||
}
|
||||
result.clear();
|
||||
for(std::set<std::string>::iterator li = unique.begin();
|
||||
li != unique.end(); ++li)
|
||||
{
|
||||
result.push_back(*li);
|
||||
}
|
||||
result.insert(result.end(), unique.begin(), unique.end());
|
||||
|
||||
IncludeCacheType::value_type entry(config_upper, result);
|
||||
iter = this->SystemIncludesCache.insert(entry).first;
|
||||
|
|
|
@ -47,11 +47,8 @@ bool cmInstallFilesCommand
|
|||
else
|
||||
{
|
||||
this->IsFilesForm = false;
|
||||
std::vector<std::string>::const_iterator s = args.begin();
|
||||
for (++s;s != args.end(); ++s)
|
||||
{
|
||||
this->FinalArgs.push_back(*s);
|
||||
}
|
||||
this->FinalArgs.insert(this->FinalArgs.end(),
|
||||
args.begin() + 1, args.end());
|
||||
}
|
||||
|
||||
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
|
||||
|
|
|
@ -27,11 +27,7 @@ bool cmInstallProgramsCommand
|
|||
|
||||
this->Destination = args[0];
|
||||
|
||||
std::vector<std::string>::const_iterator s = args.begin();
|
||||
for (++s;s != args.end(); ++s)
|
||||
{
|
||||
this->FinalArgs.push_back(*s);
|
||||
}
|
||||
this->FinalArgs.insert(this->FinalArgs.end(), args.begin() + 1, args.end());
|
||||
|
||||
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
|
||||
->AddInstallComponent(this->Makefile->GetSafeDefinition(
|
||||
|
|
|
@ -634,11 +634,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
|
|||
// Parse the string to get the custom command line.
|
||||
cmCustomCommandLine commandLine;
|
||||
std::vector<std::string> cmd = cmSystemTools::ParseArguments(i->c_str());
|
||||
for(std::vector<std::string>::iterator a = cmd.begin();
|
||||
a != cmd.end(); ++a)
|
||||
{
|
||||
commandLine.push_back(*a);
|
||||
}
|
||||
commandLine.insert(commandLine.end(), cmd.begin(), cmd.end());
|
||||
|
||||
// Store this command line.
|
||||
commandLines.push_back(commandLine);
|
||||
|
@ -745,11 +741,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang,
|
|||
// Parse the string to get the custom command line.
|
||||
cmCustomCommandLine commandLine;
|
||||
std::vector<std::string> cmd = cmSystemTools::ParseArguments(i->c_str());
|
||||
for(std::vector<std::string>::iterator a = cmd.begin();
|
||||
a != cmd.end(); ++a)
|
||||
{
|
||||
commandLine.push_back(*a);
|
||||
}
|
||||
commandLine.insert(commandLine.end(), cmd.begin(), cmd.end());
|
||||
|
||||
// Store this command line.
|
||||
commandLines.push_back(commandLine);
|
||||
|
|
|
@ -1856,13 +1856,8 @@ void cmLocalUnixMakefileGenerator3
|
|||
{
|
||||
text = "Running external command ...";
|
||||
}
|
||||
std::set<std::string>::const_iterator dit;
|
||||
for ( dit = glIt->second.GetUtilities().begin();
|
||||
dit != glIt->second.GetUtilities().end();
|
||||
++ dit )
|
||||
{
|
||||
depends.push_back(*dit);
|
||||
}
|
||||
depends.insert(depends.end(), glIt->second.GetUtilities().begin(),
|
||||
glIt->second.GetUtilities().end());
|
||||
this->AppendEcho(commands, text,
|
||||
cmLocalUnixMakefileGenerator3::EchoGlobal);
|
||||
|
||||
|
|
|
@ -328,11 +328,7 @@ bool cmMacroCommand::InitialPass(std::vector<std::string> const& args,
|
|||
|
||||
// create a function blocker
|
||||
cmMacroFunctionBlocker *f = new cmMacroFunctionBlocker();
|
||||
for(std::vector<std::string>::const_iterator j = args.begin();
|
||||
j != args.end(); ++j)
|
||||
{
|
||||
f->Args.push_back(*j);
|
||||
}
|
||||
f->Args.insert(f->Args.end(), args.begin(), args.end());
|
||||
this->Makefile->AddFunctionBlocker(f);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -2567,12 +2567,7 @@ std::vector<std::string> cmMakefile
|
|||
}
|
||||
|
||||
std::vector<std::string> res;
|
||||
|
||||
std::set<std::string>::iterator fit;
|
||||
for ( fit = definitions.begin(); fit != definitions.end(); fit ++ )
|
||||
{
|
||||
res.push_back(*fit);
|
||||
}
|
||||
res.insert(res.end(), definitions.begin(), definitions.end());
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -759,13 +759,10 @@ cmMakefileTargetGenerator
|
|||
if(const char* extra_outputs_str =
|
||||
source.GetProperty("OBJECT_OUTPUTS"))
|
||||
{
|
||||
// Register these as extra files to clean.
|
||||
cmSystemTools::ExpandListArgument(extra_outputs_str, outputs);
|
||||
for(std::vector<std::string>::const_iterator eoi = outputs.begin()+1;
|
||||
eoi != outputs.end(); ++eoi)
|
||||
{
|
||||
// Register this as an extra file to clean.
|
||||
this->CleanFiles.push_back(*eoi);
|
||||
}
|
||||
this->CleanFiles.insert(this->CleanFiles.end(),
|
||||
outputs.begin() + 1, outputs.end());
|
||||
}
|
||||
|
||||
// Write the rule.
|
||||
|
@ -1174,11 +1171,7 @@ cmMakefileTargetGenerator
|
|||
{
|
||||
cmCustomCommandGenerator ccg(*cc, this->ConfigName, this->Makefile);
|
||||
const std::vector<std::string>& outputs = ccg.GetOutputs();
|
||||
for(std::vector<std::string>::const_iterator o = outputs.begin();
|
||||
o != outputs.end(); ++o)
|
||||
{
|
||||
depends.push_back(*o);
|
||||
}
|
||||
depends.insert(depends.end(), outputs.begin(), outputs.end());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1462,11 +1455,8 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(
|
|||
}
|
||||
|
||||
// Make sure the extra files are built.
|
||||
for(std::set<std::string>::const_iterator i = this->ExtraFiles.begin();
|
||||
i != this->ExtraFiles.end(); ++i)
|
||||
{
|
||||
depends.push_back(*i);
|
||||
}
|
||||
depends.insert(depends.end(),
|
||||
this->ExtraFiles.begin(), this->ExtraFiles.end());
|
||||
}
|
||||
|
||||
// Write the driver rule.
|
||||
|
@ -1553,11 +1543,7 @@ void cmMakefileTargetGenerator
|
|||
if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg))
|
||||
{
|
||||
std::vector<std::string> const& libDeps = cli->GetDepends();
|
||||
for(std::vector<std::string>::const_iterator j = libDeps.begin();
|
||||
j != libDeps.end(); ++j)
|
||||
{
|
||||
depends.push_back(*j);
|
||||
}
|
||||
depends.insert(depends.end(), libDeps.begin(), libDeps.end());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1577,12 +1563,8 @@ void cmMakefileTargetGenerator
|
|||
}
|
||||
|
||||
// Add dependencies on the external object files.
|
||||
for(std::vector<std::string>::const_iterator obj
|
||||
= this->ExternalObjects.begin();
|
||||
obj != this->ExternalObjects.end(); ++obj)
|
||||
{
|
||||
depends.push_back(*obj);
|
||||
}
|
||||
depends.insert(depends.end(),
|
||||
this->ExternalObjects.begin(), this->ExternalObjects.end());
|
||||
|
||||
// Add a dependency on the rule file itself.
|
||||
this->LocalGenerator->AppendRuleDepend(depends,
|
||||
|
|
|
@ -2188,24 +2188,12 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile,
|
|||
|
||||
std::vector<std::string> command;
|
||||
command.push_back(this->MocExecutable);
|
||||
for (std::list<std::string>::const_iterator it = this->MocIncludes.begin();
|
||||
it != this->MocIncludes.end();
|
||||
++it)
|
||||
{
|
||||
command.push_back(*it);
|
||||
}
|
||||
for(std::list<std::string>::const_iterator it=this->MocDefinitions.begin();
|
||||
it != this->MocDefinitions.end();
|
||||
++it)
|
||||
{
|
||||
command.push_back(*it);
|
||||
}
|
||||
for(std::vector<std::string>::const_iterator it=this->MocOptions.begin();
|
||||
it != this->MocOptions.end();
|
||||
++it)
|
||||
{
|
||||
command.push_back(*it);
|
||||
}
|
||||
command.insert(command.end(),
|
||||
this->MocIncludes.begin(), this->MocIncludes.end());
|
||||
command.insert(command.end(),
|
||||
this->MocDefinitions.begin(), this->MocDefinitions.end());
|
||||
command.insert(command.end(),
|
||||
this->MocOptions.begin(), this->MocOptions.end());
|
||||
#ifdef _WIN32
|
||||
command.push_back("-DWIN32");
|
||||
#endif
|
||||
|
@ -2277,12 +2265,7 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName,
|
|||
cmSystemTools::ExpandListArgument(optionIt->second, fileOpts);
|
||||
this->MergeUicOptions(opts, fileOpts, this->QtMajorVersion == "5");
|
||||
}
|
||||
for(std::vector<std::string>::const_iterator optIt = opts.begin();
|
||||
optIt != opts.end();
|
||||
++optIt)
|
||||
{
|
||||
command.push_back(*optIt);
|
||||
}
|
||||
command.insert(command.end(), opts.begin(), opts.end());
|
||||
|
||||
command.push_back("-o");
|
||||
command.push_back(this->Builddir + ui_output_file);
|
||||
|
|
|
@ -39,10 +39,7 @@ bool cmRemoveCommand
|
|||
// check for REMOVE(VAR v1 v2 ... vn)
|
||||
std::vector<std::string> argsExpanded;
|
||||
std::vector<std::string> temp;
|
||||
for(unsigned int j = 1; j < args.size(); ++j)
|
||||
{
|
||||
temp.push_back(args[j]);
|
||||
}
|
||||
temp.insert(temp.end(), args.begin() + 1, args.end());
|
||||
cmSystemTools::ExpandList(temp, argsExpanded);
|
||||
|
||||
// now create the new value
|
||||
|
|
|
@ -1273,11 +1273,7 @@ bool cmSystemTools::Split(const char* s, std::vector<std::string>& l)
|
|||
{
|
||||
std::vector<std::string> temp;
|
||||
bool res = Superclass::Split(s, temp);
|
||||
for(std::vector<std::string>::const_iterator i = temp.begin();
|
||||
i != temp.end(); ++i)
|
||||
{
|
||||
l.push_back(*i);
|
||||
}
|
||||
l.insert(l.end(), temp.begin(), temp.end());
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -6449,11 +6449,8 @@ cmTargetInternals::ComputeLinkImplementationLanguages(
|
|||
// Get languages used in our source files.
|
||||
thisTarget->GetLanguages(languages, config);
|
||||
// Copy the set of langauges to the link implementation.
|
||||
for(std::set<std::string>::iterator li = languages.begin();
|
||||
li != languages.end(); ++li)
|
||||
{
|
||||
impl.Languages.push_back(*li);
|
||||
}
|
||||
impl.Languages.insert(impl.Languages.begin(),
|
||||
languages.begin(), languages.end());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue