diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-05-27 11:55:40 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-05-27 11:55:40 +0200 |
commit | 708fb012762d38d2a50722a1ea50da2a7eb98d05 (patch) | |
tree | 538d9afae830980ee2f84a5a89a17def9035913c /include/llmr/style | |
parent | 9477097f0f7819d79884a46c97a5183078acb68d (diff) | |
download | qtlocation-mapboxgl-708fb012762d38d2a50722a1ea50da2a7eb98d05.tar.gz |
used unordered_maps
Diffstat (limited to 'include/llmr/style')
-rw-r--r-- | include/llmr/style/properties.hpp | 14 | ||||
-rw-r--r-- | include/llmr/style/style.hpp | 8 |
2 files changed, 18 insertions, 4 deletions
diff --git a/include/llmr/style/properties.hpp b/include/llmr/style/properties.hpp index af304c1ea0..4dfc7e40b5 100644 --- a/include/llmr/style/properties.hpp +++ b/include/llmr/style/properties.hpp @@ -6,6 +6,7 @@ #include <string> #include <limits> #include <set> +#include <type_traits> #include <boost/optional.hpp> @@ -221,4 +222,17 @@ const CompositeProperties defaultCompositeProperties; } + +namespace std { + +template <> struct hash<llmr::TransitionablePropertyKey> { +public: + inline size_t operator()(llmr::TransitionablePropertyKey prop) const { + typedef typename std::underlying_type<llmr::TransitionablePropertyKey>::type type; + return std::hash<type>()(static_cast<type>(prop)); + } +}; + +} + #endif diff --git a/include/llmr/style/style.hpp b/include/llmr/style/style.hpp index 048c4d545a..4250597585 100644 --- a/include/llmr/style/style.hpp +++ b/include/llmr/style/style.hpp @@ -59,7 +59,7 @@ public: std::unordered_map<std::string, TextProperties> texts; std::unordered_map<std::string, RasterProperties> rasters; std::unordered_map<std::string, CompositeProperties> composites; - std::map<std::string, std::map<TransitionablePropertyKey, std::string>> effective_classes; + std::unordered_map<std::string, std::unordered_map<TransitionablePropertyKey, std::string>> effective_classes; } computed; private: @@ -81,7 +81,7 @@ private: std::unordered_map<std::string, TextProperties> texts; std::unordered_map<std::string, RasterProperties> rasters; std::unordered_map<std::string, CompositeProperties> composites; - std::map<std::string, std::map<TransitionablePropertyKey, std::string>> effective_classes; + std::unordered_map<std::string, std::unordered_map<TransitionablePropertyKey, std::string>> effective_classes; } previous; // Settings values currently being transitioned. @@ -95,8 +95,8 @@ private: std::unordered_map<std::string, CompositeProperties> composites; } transitioning; - std::map<std::string, std::map<TransitionablePropertyKey, PropertyTransition>> properties_to_transition; - std::map<std::string, std::map<TransitionablePropertyKey, std::shared_ptr<util::transition>>> transitions; + std::unordered_map<std::string, std::unordered_map<TransitionablePropertyKey, PropertyTransition>> properties_to_transition; + std::unordered_map<std::string, std::unordered_map<TransitionablePropertyKey, std::shared_ptr<util::transition>>> transitions; uint64_t default_transition_duration = 0; bool initial_render_complete = false; |