summaryrefslogtreecommitdiff
path: root/src/mbgl/tile/tile_id_hash.cpp
blob: 4a1f185817209fa11a7ea7adb29177a128d7a47d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <mbgl/tile/tile_id.hpp>

#include <boost/functional/hash.hpp>

namespace std {

size_t hash<mbgl::CanonicalTileID>::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;
}

size_t hash<mbgl::UnwrappedTileID>::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;
}

size_t hash<mbgl::OverscaledTileID>::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