summaryrefslogtreecommitdiffstats
path: root/Source/CPack
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2017-05-04 14:12:45 (GMT)
committerBrad King <brad.king@kitware.com>2017-05-04 15:17:49 (GMT)
commit3e027d9def0f2d9f542cb71eda12e9527c418c9e (patch)
tree5e1baea6d8eb68854e5ff0f13729b23a2fffdff4 /Source/CPack
parentec526768ac5f1e00a39075cd07fd93cffa1f1818 (diff)
downloadCMake-3e027d9def0f2d9f542cb71eda12e9527c418c9e.zip
CMake-3e027d9def0f2d9f542cb71eda12e9527c418c9e.tar.gz
CMake-3e027d9def0f2d9f542cb71eda12e9527c418c9e.tar.bz2
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/CPack')
-rw-r--r--Source/CPack/WiX/cmWIXPatchParser.h6
-rw-r--r--Source/CPack/cmCPackGenerator.cxx6
2 files changed, 6 insertions, 6 deletions
diff --git a/Source/CPack/WiX/cmWIXPatchParser.h b/Source/CPack/WiX/cmWIXPatchParser.h
index c0c96cd..52c7e35 100644
--- a/Source/CPack/WiX/cmWIXPatchParser.h
+++ b/Source/CPack/WiX/cmWIXPatchParser.h
@@ -7,8 +7,8 @@
#include "cmXMLParser.h"
-#include <list>
#include <map>
+#include <vector>
struct cmWIXPatchNode
{
@@ -36,7 +36,7 @@ struct cmWIXPatchElement : cmWIXPatchNode
~cmWIXPatchElement();
- typedef std::list<cmWIXPatchNode*> child_list_t;
+ typedef std::vector<cmWIXPatchNode*> child_list_t;
typedef std::map<std::string, std::string> attributes_t;
std::string name;
@@ -84,7 +84,7 @@ private:
fragment_map_t& Fragments;
- std::list<cmWIXPatchElement*> ElementStack;
+ std::vector<cmWIXPatchElement*> ElementStack;
};
#endif
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index a95ca76..c5495c6 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -6,7 +6,6 @@
#include "cmsys/Glob.hxx"
#include "cmsys/RegularExpression.hxx"
#include <algorithm>
-#include <list>
#include <utility>
#include "cmCPackComponentGroup.h"
@@ -314,7 +313,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
const std::string& tempDir = tempInstallDirectory;
for (it = installDirectoriesVector.begin();
it != installDirectoriesVector.end(); ++it) {
- std::list<std::pair<std::string, std::string> > symlinkedFiles;
+ std::vector<std::pair<std::string, std::string> > symlinkedFiles;
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Find files" << std::endl);
cmsys::Glob gl;
std::string top = *it;
@@ -378,7 +377,8 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
}
/* rebuild symlinks in the installed tree */
if (!symlinkedFiles.empty()) {
- std::list<std::pair<std::string, std::string> >::iterator symlinkedIt;
+ std::vector<std::pair<std::string, std::string> >::iterator
+ symlinkedIt;
std::string curDir = cmSystemTools::GetCurrentWorkingDirectory();
std::string goToDir = tempDir;
goToDir += "/" + subdir;