diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2017-05-04 14:12:45 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-05-04 15:17:49 (GMT) |
commit | 3e027d9def0f2d9f542cb71eda12e9527c418c9e (patch) | |
tree | 5e1baea6d8eb68854e5ff0f13729b23a2fffdff4 /Source/CTest/cmCTestSVN.cxx | |
parent | ec526768ac5f1e00a39075cd07fd93cffa1f1818 (diff) | |
download | CMake-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/cmCTestSVN.cxx')
-rw-r--r-- | Source/CTest/cmCTestSVN.cxx | 12 |
1 files changed, 6 insertions, 6 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; |