Use two-iterator std::set::insert where appropriate.

This commit is contained in:
Stephen Kelly 2014-11-25 16:33:00 +01:00
parent 238dd2fbab
commit 6162c9194b
18 changed files with 41 additions and 168 deletions

View File

@ -1150,12 +1150,7 @@ void cmCPackWIXGenerator::CollectExtensions(
std::vector<std::string> list; std::vector<std::string> list;
cmSystemTools::ExpandListArgument(variableContent, list); cmSystemTools::ExpandListArgument(variableContent, list);
extensions.insert(list.begin(), list.end());
for(std::vector<std::string>::const_iterator i = list.begin();
i != list.end(); ++i)
{
extensions.insert(*i);
}
} }
void cmCPackWIXGenerator::AddCustomFlags( void cmCPackWIXGenerator::AddCustomFlags(

View File

@ -2498,11 +2498,7 @@ void cmCTestCoverageHandler::LoadLabels(const char* dir)
// Label the source with the target labels. // Label the source with the target labels.
LabelSet& labelSet = this->SourceLabels[source]; LabelSet& labelSet = this->SourceLabels[source];
for(std::vector<int>::const_iterator li = targetLabels.begin(); labelSet.insert(targetLabels.begin(), targetLabels.end());
li != targetLabels.end(); ++li)
{
labelSet.insert(*li);
}
} }
} }
} }

View File

@ -162,12 +162,9 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test)
//--------------------------------------------------------- //---------------------------------------------------------
void cmCTestMultiProcessHandler::LockResources(int index) void cmCTestMultiProcessHandler::LockResources(int index)
{ {
for(std::set<std::string>::iterator i = this->LockedResources.insert(
this->Properties[index]->LockedResources.begin(); this->Properties[index]->LockedResources.begin(),
i != this->Properties[index]->LockedResources.end(); ++i) this->Properties[index]->LockedResources.end());
{
this->LockedResources.insert(*i);
}
} }
//--------------------------------------------------------- //---------------------------------------------------------
@ -499,11 +496,7 @@ void cmCTestMultiProcessHandler::CreateParallelTestCostList()
i != previousSet.end(); ++i) i != previousSet.end(); ++i)
{ {
TestSet const& dependencies = this->Tests[*i]; TestSet const& dependencies = this->Tests[*i];
for(TestSet::const_iterator j = dependencies.begin(); currentSet.insert(dependencies.begin(), dependencies.end());
j != dependencies.end(); ++j)
{
currentSet.insert(*j);
}
} }
for(TestSet::const_iterator i = currentSet.begin(); for(TestSet::const_iterator i = currentSet.begin();

View File

@ -1160,11 +1160,7 @@ int cmCTestSubmitHandler::ProcessHandler()
{ {
// Submit the explicitly selected files: // Submit the explicitly selected files:
// //
cmCTest::SetOfStrings::const_iterator it; files.insert(this->Files.begin(), this->Files.end());
for (it = this->Files.begin(); it != this->Files.end(); ++it)
{
files.insert(*it);
}
} }
// Add to the list of files to submit from any selected, existing parts: // Add to the list of files to submit from any selected, existing parts:
@ -1219,11 +1215,7 @@ int cmCTestSubmitHandler::ProcessHandler()
// Submit files from this part. // Submit files from this part.
std::vector<std::string> const& pfiles = this->CTest->GetSubmitFiles(p); std::vector<std::string> const& pfiles = this->CTest->GetSubmitFiles(p);
for(std::vector<std::string>::const_iterator pi = pfiles.begin(); files.insert(pfiles.begin(), pfiles.end());
pi != pfiles.end(); ++pi)
{
files.insert(*pi);
}
} }
if ( ofs ) if ( ofs )
@ -1503,9 +1495,5 @@ void cmCTestSubmitHandler::SelectParts(std::set<cmCTest::Part> const& parts)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmCTestSubmitHandler::SelectFiles(cmCTest::SetOfStrings const& files) void cmCTestSubmitHandler::SelectFiles(cmCTest::SetOfStrings const& files)
{ {
cmCTest::SetOfStrings::const_iterator it; this->Files.insert(files.begin(), files.end());
for (it = files.begin(); it != files.end(); ++it)
{
this->Files.insert(*it);
}
} }

View File

@ -2163,11 +2163,7 @@ bool cmCTestTestHandler::SetTestsProperties(
std::vector<std::string> lval; std::vector<std::string> lval;
cmSystemTools::ExpandListArgument(val, lval); cmSystemTools::ExpandListArgument(val, lval);
for(std::vector<std::string>::iterator f = lval.begin(); rtit->LockedResources.insert(lval.begin(), lval.end());
f != lval.end(); ++f)
{
rtit->LockedResources.insert(*f);
}
} }
if ( key == "TIMEOUT" ) if ( key == "TIMEOUT" )
{ {

View File

@ -50,13 +50,8 @@ void cmCommandArgument::FollowsGroup(const cmCommandArgumentGroup* group)
if (group!=0) if (group!=0)
{ {
this->ArgumentsBeforeEmpty = false; this->ArgumentsBeforeEmpty = false;
for(std::vector<cmCommandArgument*>::const_iterator this->ArgumentsBefore.insert(group->ContainedArguments.begin(),
argIt= group->ContainedArguments.begin(); group->ContainedArguments.end());
argIt != group->ContainedArguments.end();
++argIt)
{
this->ArgumentsBefore.insert(*argIt);
}
} }
} }

View File

@ -408,11 +408,7 @@ cmComputeLinkInformation
// Construct a mask to not bother with this behavior for link // Construct a mask to not bother with this behavior for link
// directories already specified by the user. // directories already specified by the user.
std::vector<std::string> const& dirs = this->Target->GetLinkDirectories(); std::vector<std::string> const& dirs = this->Target->GetLinkDirectories();
for(std::vector<std::string>::const_iterator di = dirs.begin(); this->OldLinkDirMask.insert(dirs.begin(), dirs.end());
di != dirs.end(); ++di)
{
this->OldLinkDirMask.insert(*di);
}
} }
} }
@ -1420,11 +1416,8 @@ void cmComputeLinkInformation::ComputeFrameworkInfo()
cmSystemTools::ExpandListArgument(implicitDirs, implicitDirVec); cmSystemTools::ExpandListArgument(implicitDirs, implicitDirVec);
} }
for(std::vector<std::string>::const_iterator i = implicitDirVec.begin(); this->FrameworkPathsEmmitted.insert(implicitDirVec.begin(),
i != implicitDirVec.end(); ++i) implicitDirVec.end());
{
this->FrameworkPathsEmmitted.insert(*i);
}
// Regular expression to extract a framework path and name. // Regular expression to extract a framework path and name.
this->SplitFramework.compile("(.*)/(.*)\\.framework$"); this->SplitFramework.compile("(.*)/(.*)\\.framework$");
@ -1694,11 +1687,7 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo()
} }
// Store implicit link directories. // Store implicit link directories.
for(std::vector<std::string>::const_iterator i = implicitDirVec.begin(); this->ImplicitLinkDirs.insert(implicitDirVec.begin(), implicitDirVec.end());
i != implicitDirVec.end(); ++i)
{
this->ImplicitLinkDirs.insert(*i);
}
// Get language-specific implicit libraries. // Get language-specific implicit libraries.
std::vector<std::string> implicitLibVec; std::vector<std::string> implicitLibVec;

View File

@ -125,11 +125,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
this->ValidDeps->find(obj); this->ValidDeps->find(obj);
if (tmpIt!= this->ValidDeps->end()) if (tmpIt!= this->ValidDeps->end())
{ {
for(DependencyVector::const_iterator i=tmpIt->second.begin(); dependencies.insert(tmpIt->second.begin(), tmpIt->second.end());
i != tmpIt->second.end(); ++i)
{
dependencies.insert(*i);
}
haveDeps = true; haveDeps = true;
} }
} }

View File

@ -319,17 +319,13 @@ void cmDependsFortran::LocateModules()
infoI != objInfo.end(); ++infoI) infoI != objInfo.end(); ++infoI)
{ {
cmDependsFortranSourceInfo const& info = infoI->second; cmDependsFortranSourceInfo const& info = infoI->second;
for(std::set<std::string>::const_iterator i = info.Provides.begin(); // Include this module in the set provided by this target.
i != info.Provides.end(); ++i) this->Internal->TargetProvides.insert(info.Provides.begin(),
{ info.Provides.end());
// Include this module in the set provided by this target.
this->Internal->TargetProvides.insert(*i);
}
for(std::set<std::string>::const_iterator i = info.Requires.begin(); for(std::set<std::string>::const_iterator i = info.Requires.begin();
i != info.Requires.end(); ++i) i != info.Requires.end(); ++i)
{ {
// Include this module in the set required by this target.
this->Internal->TargetRequires[*i] = ""; this->Internal->TargetRequires[*i] = "";
} }
} }

View File

@ -456,11 +456,7 @@ void getPropertyContents(cmTarget const* tgt, const std::string& prop,
} }
std::vector<std::string> content; std::vector<std::string> content;
cmSystemTools::ExpandListArgument(p, content); cmSystemTools::ExpandListArgument(p, content);
for (std::vector<std::string>::const_iterator ci = content.begin(); ifaceProperties.insert(content.begin(), content.end());
ci != content.end(); ++ci)
{
ifaceProperties.insert(*ci);
}
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -615,12 +615,8 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
std::vector<std::string> includes; std::vector<std::string> includes;
target->GetMakefile()->GetLocalGenerator()-> target->GetMakefile()->GetLocalGenerator()->
GetIncludeDirectories(includes, gtgt, "C", buildType); GetIncludeDirectories(includes, gtgt, "C", buildType);
for(std::vector<std::string>::const_iterator dirIt=includes.begin();
dirIt != includes.end(); uniqIncludeDirs.insert(includes.begin(), includes.end());
++dirIt)
{
uniqIncludeDirs.insert(*dirIt);
}
std::string systemIncludeDirs = makefile->GetSafeDefinition( std::string systemIncludeDirs = makefile->GetSafeDefinition(
"CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS"); "CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS");
@ -628,12 +624,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
{ {
std::vector<std::string> dirs; std::vector<std::string> dirs;
cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs); cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs);
for(std::vector<std::string>::const_iterator dirIt=dirs.begin(); uniqIncludeDirs.insert(dirs.begin(), dirs.end());
dirIt != dirs.end();
++dirIt)
{
uniqIncludeDirs.insert(*dirIt);
}
} }
systemIncludeDirs = makefile->GetSafeDefinition( systemIncludeDirs = makefile->GetSafeDefinition(
@ -642,12 +633,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
{ {
std::vector<std::string> dirs; std::vector<std::string> dirs;
cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs); cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs);
for(std::vector<std::string>::const_iterator dirIt=dirs.begin(); uniqIncludeDirs.insert(dirs.begin(), dirs.end());
dirIt != dirs.end();
++dirIt)
{
uniqIncludeDirs.insert(*dirIt);
}
} }
for(std::set<std::string>::const_iterator dirIt=uniqIncludeDirs.begin(); for(std::set<std::string>::const_iterator dirIt=uniqIncludeDirs.begin();

View File

@ -818,11 +818,7 @@ cmTargetTraceDependencies
= ge.Parse(*cli); = ge.Parse(*cli);
cge->Evaluate(this->Makefile, "", true); cge->Evaluate(this->Makefile, "", true);
std::set<cmTarget*> geTargets = cge->GetTargets(); std::set<cmTarget*> geTargets = cge->GetTargets();
for(std::set<cmTarget*>::const_iterator it = geTargets.begin(); targets.insert(geTargets.begin(), geTargets.end());
it != geTargets.end(); ++it)
{
targets.insert(*it);
}
} }
} }

View File

@ -1021,12 +1021,9 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os)
} }
//insert outputs from all WirteBuild commands //insert outputs from all WirteBuild commands
for(std::set<std::string>::iterator i = this->CombinedBuildOutputs.begin(); //these paths have already be encoded when added to CombinedBuildOutputs
i != this->CombinedBuildOutputs.end(); ++i) knownDependencies.insert(this->CombinedBuildOutputs.begin(),
{ this->CombinedBuildOutputs.end());
//these paths have already be encoded when added to CombinedBuildOutputs
knownDependencies.insert(*i);
}
//after we have combined the data into knownDependencies we have no need //after we have combined the data into knownDependencies we have no need
//to keep this data around //to keep this data around

View File

@ -845,22 +845,14 @@ cmGlobalVisualStudioGenerator::TargetCompare
cmGlobalVisualStudioGenerator::OrderedTargetDependSet cmGlobalVisualStudioGenerator::OrderedTargetDependSet
::OrderedTargetDependSet(TargetDependSet const& targets) ::OrderedTargetDependSet(TargetDependSet const& targets)
{ {
for(TargetDependSet::const_iterator ti = this->insert(targets.begin(), targets.end());
targets.begin(); ti != targets.end(); ++ti)
{
this->insert(*ti);
}
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmGlobalVisualStudioGenerator::OrderedTargetDependSet cmGlobalVisualStudioGenerator::OrderedTargetDependSet
::OrderedTargetDependSet(TargetSet const& targets) ::OrderedTargetDependSet(TargetSet const& targets)
{ {
for(TargetSet::const_iterator ti = targets.begin(); this->insert(targets.begin(), targets.end());
ti != targets.end(); ++ti)
{
this->insert(*ti);
}
} }
std::string cmGlobalVisualStudioGenerator::ExpandCFGIntDir( std::string cmGlobalVisualStudioGenerator::ExpandCFGIntDir(

View File

@ -71,11 +71,7 @@ bool cmIncludeDirectoryCommand
} }
if (system) if (system)
{ {
for (std::vector<std::string>::const_iterator li = includes.begin(); systemIncludes.insert(includes.begin(), includes.end());
li != includes.end(); ++li)
{
systemIncludes.insert(*li);
}
} }
} }
std::reverse(beforeIncludes.begin(), beforeIncludes.end()); std::reverse(beforeIncludes.begin(), beforeIncludes.end());

View File

@ -1822,11 +1822,7 @@ void cmMakefile::AddIncludeDirectories(const std::vector<std::string> &incs,
void void
cmMakefile::AddSystemIncludeDirectories(const std::set<std::string> &incs) cmMakefile::AddSystemIncludeDirectories(const std::set<std::string> &incs)
{ {
for(std::set<std::string>::const_iterator li = incs.begin(); this->SystemIncludeDirectories.insert(incs.begin(), incs.end());
li != incs.end(); ++li)
{
this->SystemIncludeDirectories.insert(*li);
}
for (cmTargets::iterator l = this->Targets.begin(); for (cmTargets::iterator l = this->Targets.begin();
l != this->Targets.end(); ++l) l != this->Targets.end(); ++l)
@ -4556,16 +4552,8 @@ void cmMakefile::PopScope()
this->Internal->VarInitStack.pop(); this->Internal->VarInitStack.pop();
this->Internal->VarUsageStack.pop(); this->Internal->VarUsageStack.pop();
// Push initialization and usage up to the parent scope. // Push initialization and usage up to the parent scope.
it = init.begin(); this->Internal->VarInitStack.top().insert(init.begin(), init.end());
for (; it != init.end(); ++it) this->Internal->VarUsageStack.top().insert(usage.begin(), usage.end());
{
this->Internal->VarInitStack.top().insert(*it);
}
it = usage.begin();
for (; it != usage.end(); ++it)
{
this->Internal->VarUsageStack.top().insert(*it);
}
} }
void cmMakefile::RaiseScope(const std::string& var, const char *varDef) void cmMakefile::RaiseScope(const std::string& var, const char *varDef)

View File

@ -899,12 +899,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target,
std::set<std::string> skipped; std::set<std::string> skipped;
std::vector<std::string> skipVec; std::vector<std::string> skipVec;
cmSystemTools::ExpandListArgument(this->SkipUic, skipVec); cmSystemTools::ExpandListArgument(this->SkipUic, skipVec);
skipped.insert(skipVec.begin(), skipVec.end());
for (std::vector<std::string>::const_iterator li = skipVec.begin();
li != skipVec.end(); ++li)
{
skipped.insert(*li);
}
makefile->AddDefinition("_skip_uic", makefile->AddDefinition("_skip_uic",
cmLocalGenerator::EscapeForCMake(this->SkipUic).c_str()); cmLocalGenerator::EscapeForCMake(this->SkipUic).c_str());
@ -1622,12 +1617,7 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
std::vector<std::string> headerFilesVec; std::vector<std::string> headerFilesVec;
cmSystemTools::ExpandListArgument(this->Headers, headerFilesVec); cmSystemTools::ExpandListArgument(this->Headers, headerFilesVec);
for (std::vector<std::string>::const_iterator it = headerFilesVec.begin(); headerFiles.insert(headerFilesVec.begin(), headerFilesVec.end());
it != headerFilesVec.end();
++it)
{
headerFiles.insert(*it);
}
// key = moc source filepath, value = moc output filename // key = moc source filepath, value = moc output filename
std::map<std::string, std::string> notIncludedMocs; std::map<std::string, std::string> notIncludedMocs;

View File

@ -424,12 +424,8 @@ void cmTarget::SetMakefile(cmMakefile* mf)
const std::set<std::string> parentSystemIncludes = const std::set<std::string> parentSystemIncludes =
this->Makefile->GetSystemIncludeDirectories(); this->Makefile->GetSystemIncludeDirectories();
for (std::set<std::string>::const_iterator it this->SystemIncludeDirectories.insert(parentSystemIncludes.begin(),
= parentSystemIncludes.begin(); parentSystemIncludes.end());
it != parentSystemIncludes.end(); ++it)
{
this->SystemIncludeDirectories.insert(*it);
}
const std::vector<cmValueWithOrigin> parentOptions = const std::vector<cmValueWithOrigin> parentOptions =
this->Makefile->GetCompileOptionsEntries(); this->Makefile->GetCompileOptionsEntries();
@ -1397,22 +1393,14 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf,
void void
cmTarget::AddSystemIncludeDirectories(const std::set<std::string> &incs) cmTarget::AddSystemIncludeDirectories(const std::set<std::string> &incs)
{ {
for(std::set<std::string>::const_iterator li = incs.begin(); this->SystemIncludeDirectories.insert(incs.begin(), incs.end());
li != incs.end(); ++li)
{
this->SystemIncludeDirectories.insert(*li);
}
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
cmTarget::AddSystemIncludeDirectories(const std::vector<std::string> &incs) cmTarget::AddSystemIncludeDirectories(const std::vector<std::string> &incs)
{ {
for(std::vector<std::string>::const_iterator li = incs.begin(); this->SystemIncludeDirectories.insert(incs.begin(), incs.end());
li != incs.end(); ++li)
{
this->SystemIncludeDirectories.insert(*li);
}
} }
#if defined(_WIN32) && !defined(__CYGWIN__) #if defined(_WIN32) && !defined(__CYGWIN__)