diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2019-06-03 10:29:12 +0200 |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2019-06-08 12:25:35 +0200 |
commit | 00d265e3c812516e2a71faed4f352b36f51112e2 (patch) | |
tree | 788623862269c9291c444bd2d947ff3b1f80584e /Source/cmPropertyMap.cxx | |
parent | 1b945f95bafc9a795b092904f7c6bd84dad940e8 (diff) | |
download | cmake-00d265e3c812516e2a71faed4f352b36f51112e2.tar.gz |
cmPropertyMap: Use std::unordered_map as container instead of std::map
Diffstat (limited to 'Source/cmPropertyMap.cxx')
-rw-r--r-- | Source/cmPropertyMap.cxx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx index 64bceb5139..3ed4c057c0 100644 --- a/Source/cmPropertyMap.cxx +++ b/Source/cmPropertyMap.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmPropertyMap.h" +#include <algorithm> #include <utility> void cmPropertyMap::Clear() @@ -59,15 +60,21 @@ std::vector<std::string> cmPropertyMap::GetKeys() const for (auto const& item : Map_) { keyList.push_back(item.first); } + std::sort(keyList.begin(), keyList.end()); return keyList; } std::vector<std::pair<std::string, std::string>> cmPropertyMap::GetList() const { - std::vector<std::pair<std::string, std::string>> kvList; + typedef std::pair<std::string, std::string> StringPair; + std::vector<StringPair> kvList; kvList.reserve(Map_.size()); for (auto const& item : Map_) { kvList.emplace_back(item.first, item.second); } + std::sort(kvList.begin(), kvList.end(), + [](StringPair const& a, StringPair const& b) { + return a.first < b.first; + }); return kvList; } |