Merge topic 'use-member-insert'

fa889c4d cmakemain: Initialize vector content with iterators directly.
8211010c cmakemain: Use member insert in command line handling code.
b5422573 cmListCommand: Replace loop with member algorithm.
92a37f92 Convert raw loops to set member insert.
aac44e71 Convert raw loops to vector member insert.
This commit is contained in:
Brad King 2015-01-19 09:43:27 -05:00 committed by CMake Topic Stage
commit a6bbbd0f4a
6 changed files with 13 additions and 36 deletions

View File

@ -676,11 +676,8 @@ void cmComputeLinkDepends::InferDependencies()
} }
// Add the inferred dependencies to the graph. // Add the inferred dependencies to the graph.
for(DependSet::const_iterator j = common.begin(); j != common.end(); ++j) cmGraphEdgeList& edges = this->EntryConstraintGraph[depender_index];
{ edges.insert(edges.end(), common.begin(), common.end());
int dependee_index = *j;
this->EntryConstraintGraph[depender_index].push_back(dependee_index);
}
} }
} }

View File

@ -98,12 +98,8 @@ const char *cmCompiledGeneratorExpression::Evaluate(
{ {
this->Output += (*it)->Evaluate(&context, dagChecker); this->Output += (*it)->Evaluate(&context, dagChecker);
for(std::set<std::string>::const_iterator this->SeenTargetProperties.insert(context.SeenTargetProperties.begin(),
p = context.SeenTargetProperties.begin(); context.SeenTargetProperties.end());
p != context.SeenTargetProperties.end(); ++p)
{
this->SeenTargetProperties.insert(*p);
}
if (context.HadError) if (context.HadError)
{ {
this->Output = ""; this->Output = "";

View File

@ -345,13 +345,9 @@ bool cmListCommand::HandleInsertCommand(std::vector<std::string> const& args)
return false; return false;
} }
} }
size_t cc;
size_t cnt = 0; varArgsExpanded.insert(varArgsExpanded.begin()+item,
for ( cc = 3; cc < args.size(); ++ cc ) args.begin() + 3, args.end());
{
varArgsExpanded.insert(varArgsExpanded.begin()+item+cnt, args[cc]);
cnt ++;
}
std::string value = cmJoin(varArgsExpanded, ";"); std::string value = cmJoin(varArgsExpanded, ";");
this->Makefile->AddDefinition(listName, value.c_str()); this->Makefile->AddDefinition(listName, value.c_str());

View File

@ -110,10 +110,7 @@ bool cmLoadCacheCommand::ReadWithPrefix(std::vector<std::string> const& args)
// Prepare the table of variables to read. // Prepare the table of variables to read.
this->Prefix = args[2]; this->Prefix = args[2];
for(unsigned int i=3; i < args.size(); ++i) this->VariablesToRead.insert(args.begin() + 3, args.end());
{
this->VariablesToRead.insert(args[i]);
}
// Read the cache file. // Read the cache file.
cmsys::ifstream fin(cacheFile.c_str()); cmsys::ifstream fin(cacheFile.c_str());

View File

@ -738,11 +738,8 @@ cmLocalUnixMakefileGenerator3
// Add the output to the local help if requested. // Add the output to the local help if requested.
if(in_help) if(in_help)
{ {
for (std::vector<std::string>::const_iterator i = outputs.begin(); this->LocalHelp.insert(this->LocalHelp.end(),
i != outputs.end(); ++i) outputs.begin(), outputs.end());
{
this->LocalHelp.push_back(*i);
}
} }
} }

View File

@ -96,11 +96,9 @@ static const char * cmDocumentationOptions[][2] =
static int do_command(int ac, char const* const* av) static int do_command(int ac, char const* const* av)
{ {
std::vector<std::string> args; std::vector<std::string> args;
args.reserve(ac - 1);
args.push_back(av[0]); args.push_back(av[0]);
for(int i = 2; i < ac; ++i) args.insert(args.end(), av + 2, av + ac);
{
args.push_back(av[i]);
}
return cmcmd::ExecuteCMakeCommand(args); return cmcmd::ExecuteCMakeCommand(args);
} }
@ -221,11 +219,7 @@ int do_cmake(int ac, char const* const* av)
// the command line args are processed here so that you can do // the command line args are processed here so that you can do
// -DCMAKE_MODULE_PATH=/some/path and have this value accessible here // -DCMAKE_MODULE_PATH=/some/path and have this value accessible here
std::vector<std::string> args; std::vector<std::string> args(av, av + ac);
for(int i =0; i < ac; ++i)
{
args.push_back(av[i]);
}
hcm.SetCacheArgs(args); hcm.SetCacheArgs(args);
std::vector<cmDocumentationEntry> generators; std::vector<cmDocumentationEntry> generators;