[core] add explicit std::hash<mbgl::style::ClassID> implementation to appease GCC
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user