[core] add explicit std::hash<mbgl::style::ClassID> implementation to appease GCC

This commit is contained in:
Konstantin Käfer
2016-09-15 12:46:52 +02:00
parent e49c96f05c
commit ca8f32a914

View File

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