summaryrefslogtreecommitdiffstats
path: root/Source/CTest
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/CTest
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/CTest')
-rw-r--r--Source/CTest/cmCTestSVN.cxx12
-rw-r--r--Source/CTest/cmCTestSVN.h3
2 files changed, 7 insertions, 8 deletions
diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx
index 0b87281..f60f78c 100644
--- a/Source/CTest/cmCTestSVN.cxx
+++ b/Source/CTest/cmCTestSVN.cxx
@@ -103,8 +103,8 @@ bool cmCTestSVN::NoteOldRevision()
return false;
}
- std::list<SVNInfo>::iterator itbeg = this->Repositories.begin();
- std::list<SVNInfo>::iterator itend = this->Repositories.end();
+ std::vector<SVNInfo>::iterator itbeg = this->Repositories.begin();
+ std::vector<SVNInfo>::iterator itend = this->Repositories.end();
for (; itbeg != itend; itbeg++) {
SVNInfo& svninfo = *itbeg;
svninfo.OldRevision = this->LoadInfo(svninfo);
@@ -127,8 +127,8 @@ bool cmCTestSVN::NoteNewRevision()
return false;
}
- std::list<SVNInfo>::iterator itbeg = this->Repositories.begin();
- std::list<SVNInfo>::iterator itend = this->Repositories.end();
+ std::vector<SVNInfo>::iterator itbeg = this->Repositories.begin();
+ std::vector<SVNInfo>::iterator itend = this->Repositories.end();
for (; itbeg != itend; itbeg++) {
SVNInfo& svninfo = *itbeg;
svninfo.NewRevision = this->LoadInfo(svninfo);
@@ -380,8 +380,8 @@ bool cmCTestSVN::LoadRevisions()
{
bool result = true;
// Get revisions for all the external repositories
- std::list<SVNInfo>::iterator itbeg = this->Repositories.begin();
- std::list<SVNInfo>::iterator itend = this->Repositories.end();
+ std::vector<SVNInfo>::iterator itbeg = this->Repositories.begin();
+ std::vector<SVNInfo>::iterator itend = this->Repositories.end();
for (; itbeg != itend; itbeg++) {
SVNInfo& svninfo = *itbeg;
result = this->LoadRevisions(svninfo) && result;
diff --git a/Source/CTest/cmCTestSVN.h b/Source/CTest/cmCTestSVN.h
index d90d387..46b0778 100644
--- a/Source/CTest/cmCTestSVN.h
+++ b/Source/CTest/cmCTestSVN.h
@@ -8,7 +8,6 @@
#include "cmCTestGlobalVC.h"
#include <iosfwd>
-#include <list>
#include <string>
#include <vector>
@@ -71,7 +70,7 @@ private:
friend struct Revision;
// Info of all the repositories (root, externals and nested ones).
- std::list<SVNInfo> Repositories;
+ std::vector<SVNInfo> Repositories;
// Pointer to the infos of the root repository.
SVNInfo* RootInfo;