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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1822,11 +1822,7 @@ void cmMakefile::AddIncludeDirectories(const std::vector<std::string> &incs,
void
cmMakefile::AddSystemIncludeDirectories(const std::set<std::string> &incs)
{
for(std::set<std::string>::const_iterator li = incs.begin();
li != incs.end(); ++li)
{
this->SystemIncludeDirectories.insert(*li);
}
this->SystemIncludeDirectories.insert(incs.begin(), incs.end());
for (cmTargets::iterator l = this->Targets.begin();
l != this->Targets.end(); ++l)
@ -4556,16 +4552,8 @@ void cmMakefile::PopScope()
this->Internal->VarInitStack.pop();
this->Internal->VarUsageStack.pop();
// Push initialization and usage up to the parent scope.
it = init.begin();
for (; it != init.end(); ++it)
{
this->Internal->VarInitStack.top().insert(*it);
}
it = usage.begin();
for (; it != usage.end(); ++it)
{
this->Internal->VarUsageStack.top().insert(*it);
}
this->Internal->VarInitStack.top().insert(init.begin(), init.end());
this->Internal->VarUsageStack.top().insert(usage.begin(), usage.end());
}
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::vector<std::string> skipVec;
cmSystemTools::ExpandListArgument(this->SkipUic, skipVec);
for (std::vector<std::string>::const_iterator li = skipVec.begin();
li != skipVec.end(); ++li)
{
skipped.insert(*li);
}
skipped.insert(skipVec.begin(), skipVec.end());
makefile->AddDefinition("_skip_uic",
cmLocalGenerator::EscapeForCMake(this->SkipUic).c_str());
@ -1622,12 +1617,7 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
std::vector<std::string> headerFilesVec;
cmSystemTools::ExpandListArgument(this->Headers, headerFilesVec);
for (std::vector<std::string>::const_iterator it = headerFilesVec.begin();
it != headerFilesVec.end();
++it)
{
headerFiles.insert(*it);
}
headerFiles.insert(headerFilesVec.begin(), headerFilesVec.end());
// key = moc source filepath, value = moc output filename
std::map<std::string, std::string> notIncludedMocs;

View File

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