diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2016-09-15 12:46:52 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2016-09-15 13:41:59 +0200 |
commit | ca8f32a914ad724bab08b0bb1f930126b4fa8ce5 (patch) | |
tree | 0e5129cbfb17715fa57894c5adb968999e0c60ab | |
parent | e49c96f05c7e617e1e859c6818186a8b23e1f981 (diff) | |
download | qtlocation-mapboxgl-ca8f32a914ad724bab08b0bb1f930126b4fa8ce5.tar.gz |
[core] add explicit std::hash<mbgl::style::ClassID> implementation to appease GCC
-rw-r--r-- | src/mbgl/style/class_dictionary.hpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mbgl/style/class_dictionary.hpp b/src/mbgl/style/class_dictionary.hpp index c95773d7c3..e609fb5303 100644 --- a/src/mbgl/style/class_dictionary.hpp +++ b/src/mbgl/style/class_dictionary.hpp @@ -3,6 +3,7 @@ #include <cstdint> #include <string> #include <unordered_map> +#include <functional> namespace mbgl { namespace style { @@ -34,3 +35,19 @@ private: } // namespace style } // namespace mbgl + +namespace std { + +// Explicitly define std::hash<style::ClassID> because GCC doesn't automatically use std::hash<> of +// the underlying enum type. + +template <> +struct hash<mbgl::style::ClassID> { +public: + size_t operator()(const mbgl::style::ClassID id) const { + using T = std::underlying_type_t<mbgl::style::ClassID>; + return std::hash<T>()(static_cast<T>(id)); + } +}; + +} // namespace std |