diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2017-05-04 10:12:45 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-05-04 11:17:49 -0400 |
commit | 3e027d9def0f2d9f542cb71eda12e9527c418c9e (patch) | |
tree | 5e1baea6d8eb68854e5ff0f13729b23a2fffdff4 /Source/cmGlobalVisualStudio7Generator.cxx | |
parent | ec526768ac5f1e00a39075cd07fd93cffa1f1818 (diff) | |
download | cmake-3e027d9def0f2d9f542cb71eda12e9527c418c9e.tar.gz |
c++: prefer vectors over lists
None of these usages of `std::list` were inserting or removing elements
in the middle of the structure, so there were no benefits to using it.
Other uses were related to C pointers being stable in a list of strings
whereas in a vector of strings, small pointer optimizations could be
moved and become invalid after a modification to the hosting vector.
None of these uses modified the vector after handing out a C string to
an external store.
Diffstat (limited to 'Source/cmGlobalVisualStudio7Generator.cxx')
-rw-r--r-- | Source/cmGlobalVisualStudio7Generator.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 1b75a08413..f067d8f5bb 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -12,6 +12,7 @@ #include "cmsys/Encoding.hxx" #include <assert.h> +#include <vector> #include <windows.h> static cmVS7FlagTable cmVS7ExtraFlagTable[] = { @@ -680,10 +681,10 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild( // default build if another target depends on it int type = target->GetType(); if (type == cmStateEnums::GLOBAL_TARGET) { - std::list<std::string> targetNames; + std::vector<std::string> targetNames; targetNames.push_back("INSTALL"); targetNames.push_back("PACKAGE"); - for (std::list<std::string>::const_iterator t = targetNames.begin(); + for (std::vector<std::string>::const_iterator t = targetNames.begin(); t != targetNames.end(); ++t) { // check if target <*t> is part of default build if (target->GetName() == *t) { |