diff options
author | Brad Leege <bleege@gmail.com> | 2016-09-12 15:45:57 -0700 |
---|---|---|
committer | Brad Leege <bleege@gmail.com> | 2016-09-14 16:40:20 -0700 |
commit | d0f9ba499831a7412e51bd45141c9637ea484fde (patch) | |
tree | 187d7bfbb0c31e294dd9879dbb12a1e54a25903b /src/mbgl/tile/tile_id.hpp | |
parent | a9f5224664905ac28a372be6aad429a31790df03 (diff) | |
download | qtlocation-mapboxgl-d0f9ba499831a7412e51bd45141c9637ea484fde.tar.gz |
[core] #3980 - Switching Core GL instances of map to unordered_map
Diffstat (limited to 'src/mbgl/tile/tile_id.hpp')
-rw-r--r-- | src/mbgl/tile/tile_id.hpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/mbgl/tile/tile_id.hpp b/src/mbgl/tile/tile_id.hpp index f561db9a4d..88b01269e5 100644 --- a/src/mbgl/tile/tile_id.hpp +++ b/src/mbgl/tile/tile_id.hpp @@ -8,6 +8,7 @@ #include <algorithm> #include <iosfwd> #include <cassert> +#include <boost/functional/hash.hpp> namespace mbgl { @@ -254,3 +255,36 @@ inline float UnwrappedTileID::pixelsToTileUnits(const float pixelValue, const fl } } // namespace mbgl + +namespace std { + +template <> struct hash<mbgl::CanonicalTileID> { + size_t operator()(const mbgl::CanonicalTileID &id) const { + std::size_t seed = 0; + boost::hash_combine(seed, id.x); + boost::hash_combine(seed, id.y); + boost::hash_combine(seed, id.z); + return seed; + } +}; + +template <> struct hash<mbgl::UnwrappedTileID> { + size_t operator()(const mbgl::UnwrappedTileID &id) const { + std::size_t seed = 0; + boost::hash_combine(seed, std::hash<mbgl::CanonicalTileID>{}(id.canonical)); + boost::hash_combine(seed, id.wrap); + return seed; + } +}; + +template <> struct hash<mbgl::OverscaledTileID> { + size_t operator()(const mbgl::OverscaledTileID &id) const { + std::size_t seed = 0; + boost::hash_combine(seed, std::hash<mbgl::CanonicalTileID>{}(id.canonical)); + boost::hash_combine(seed, id.overscaledZ); + return seed; + } +}; + +} // namespace std + |