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