summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-01-19 14:43:27 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-01-19 14:43:27 (GMT)
commita6bbbd0f4a9ca9d683000f3302842bc25615e57a (patch)
tree208264c5b8244efcc6a8e15c39774ef46e5971ad
parent95d42840e88599ab1959f7531668e320a7c20fdf (diff)
parentfa889c4d2f49ed4b3edc8e7820b4d9bbfeeeb2a3 (diff)
downloadCMake-a6bbbd0f4a9ca9d683000f3302842bc25615e57a.zip
CMake-a6bbbd0f4a9ca9d683000f3302842bc25615e57a.tar.gz
CMake-a6bbbd0f4a9ca9d683000f3302842bc25615e57a.tar.bz2
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.
-rw-r--r--Source/cmComputeLinkDepends.cxx7
-rw-r--r--Source/cmGeneratorExpression.cxx8
-rw-r--r--Source/cmListCommand.cxx10
-rw-r--r--Source/cmLoadCacheCommand.cxx5
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx7
-rw-r--r--Source/cmakemain.cxx12
6 files changed, 13 insertions, 36 deletions
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index f0bae28..32d5cd3 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -676,11 +676,8 @@ void cmComputeLinkDepends::InferDependencies()
}
// Add the inferred dependencies to the graph.
- for(DependSet::const_iterator j = common.begin(); j != common.end(); ++j)
- {
- int dependee_index = *j;
- this->EntryConstraintGraph[depender_index].push_back(dependee_index);
- }
+ cmGraphEdgeList& edges = this->EntryConstraintGraph[depender_index];
+ edges.insert(edges.end(), common.begin(), common.end());
}
}
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index b2a2386..bf96951 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -98,12 +98,8 @@ const char *cmCompiledGeneratorExpression::Evaluate(
{
this->Output += (*it)->Evaluate(&context, dagChecker);
- for(std::set<std::string>::const_iterator
- p = context.SeenTargetProperties.begin();
- p != context.SeenTargetProperties.end(); ++p)
- {
- this->SeenTargetProperties.insert(*p);
- }
+ this->SeenTargetProperties.insert(context.SeenTargetProperties.begin(),
+ context.SeenTargetProperties.end());
if (context.HadError)
{
this->Output = "";
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index c3f0f57..5a0eee3 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -345,13 +345,9 @@ bool cmListCommand::HandleInsertCommand(std::vector<std::string> const& args)
return false;
}
}
- size_t cc;
- size_t cnt = 0;
- for ( cc = 3; cc < args.size(); ++ cc )
- {
- varArgsExpanded.insert(varArgsExpanded.begin()+item+cnt, args[cc]);
- cnt ++;
- }
+
+ varArgsExpanded.insert(varArgsExpanded.begin()+item,
+ args.begin() + 3, args.end());
std::string value = cmJoin(varArgsExpanded, ";");
this->Makefile->AddDefinition(listName, value.c_str());
diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx
index 427e29d..4f6e0c3 100644
--- a/Source/cmLoadCacheCommand.cxx
+++ b/Source/cmLoadCacheCommand.cxx
@@ -110,10 +110,7 @@ bool cmLoadCacheCommand::ReadWithPrefix(std::vector<std::string> const& args)
// Prepare the table of variables to read.
this->Prefix = args[2];
- for(unsigned int i=3; i < args.size(); ++i)
- {
- this->VariablesToRead.insert(args[i]);
- }
+ this->VariablesToRead.insert(args.begin() + 3, args.end());
// Read the cache file.
cmsys::ifstream fin(cacheFile.c_str());
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index ebaee37..46279fa 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -738,11 +738,8 @@ cmLocalUnixMakefileGenerator3
// Add the output to the local help if requested.
if(in_help)
{
- for (std::vector<std::string>::const_iterator i = outputs.begin();
- i != outputs.end(); ++i)
- {
- this->LocalHelp.push_back(*i);
- }
+ this->LocalHelp.insert(this->LocalHelp.end(),
+ outputs.begin(), outputs.end());
}
}
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 61b175e..9e84e68 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -96,11 +96,9 @@ static const char * cmDocumentationOptions[][2] =
static int do_command(int ac, char const* const* av)
{
std::vector<std::string> args;
+ args.reserve(ac - 1);
args.push_back(av[0]);
- for(int i = 2; i < ac; ++i)
- {
- args.push_back(av[i]);
- }
+ args.insert(args.end(), av + 2, av + ac);
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
// -DCMAKE_MODULE_PATH=/some/path and have this value accessible here
- std::vector<std::string> args;
- for(int i =0; i < ac; ++i)
- {
- args.push_back(av[i]);
- }
+ std::vector<std::string> args(av, av + ac);
hcm.SetCacheArgs(args);
std::vector<cmDocumentationEntry> generators;