From ca8f32a914ad724bab08b0bb1f930126b4fa8ce5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Thu, 15 Sep 2016 12:46:52 +0200 Subject: [PATCH] [core] add explicit std::hash implementation to appease GCC --- src/mbgl/style/class_dictionary.hpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/mbgl/style/class_dictionary.hpp b/src/mbgl/style/class_dictionary.hpp index c95773d7c..e609fb530 100644 --- a/src/mbgl/style/class_dictionary.hpp +++ b/src/mbgl/style/class_dictionary.hpp @@ -3,6 +3,7 @@ #include #include #include +#include namespace mbgl { namespace style { @@ -34,3 +35,19 @@ private: } // namespace style } // namespace mbgl + +namespace std { + +// Explicitly define std::hash because GCC doesn't automatically use std::hash<> of +// the underlying enum type. + +template <> +struct hash { +public: + size_t operator()(const mbgl::style::ClassID id) const { + using T = std::underlying_type_t; + return std::hash()(static_cast(id)); + } +}; + +} // namespace std