used unordered_maps

This commit is contained in:
Konstantin Käfer
2014-05-27 11:55:40 +02:00
parent 9477097f0f
commit 708fb01276
2 changed files with 18 additions and 4 deletions

View File

@@ -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

View File

@@ -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;