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/cmFileLockPool.h | |
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/cmFileLockPool.h')
-rw-r--r-- | Source/cmFileLockPool.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Source/cmFileLockPool.h b/Source/cmFileLockPool.h index 689ddd7..c96a8c2 100644 --- a/Source/cmFileLockPool.h +++ b/Source/cmFileLockPool.h @@ -5,8 +5,8 @@ #include "cmConfigure.h" -#include <list> #include <string> +#include <vector> class cmFileLock; class cmFileLockResult; @@ -70,14 +70,14 @@ private: bool IsAlreadyLocked(const std::string& filename) const; private: - typedef std::list<cmFileLock*> List; + typedef std::vector<cmFileLock*> List; typedef List::iterator It; typedef List::const_iterator CIt; List Locks; }; - typedef std::list<ScopePool*> List; + typedef std::vector<ScopePool*> List; typedef List::iterator It; typedef List::const_iterator CIt; |