diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index 9507f5c43..8fae1e017 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -30,7 +30,7 @@ #import #import -#import +#import #import #import "NSBundle+MGLAdditions.h" @@ -102,7 +102,7 @@ enum { MGLAnnotationTagNotFound = UINT32_MAX }; /// Mapping from an annotation tag to metadata about that annotation, including /// the annotation itself. -typedef std::map MGLAnnotationContextMap; +typedef std::unordered_map MGLAnnotationContextMap; /// Returns an NSImage for the default marker image. NSImage *MGLDefaultMarkerImage() { diff --git a/src/mbgl/algorithm/generate_clip_ids.hpp b/src/mbgl/algorithm/generate_clip_ids.hpp index 0454c9952..d917b398a 100644 --- a/src/mbgl/algorithm/generate_clip_ids.hpp +++ b/src/mbgl/algorithm/generate_clip_ids.hpp @@ -3,9 +3,9 @@ #include #include -#include +#include #include -#include +#include namespace mbgl { namespace algorithm { @@ -17,12 +17,12 @@ private: void add(const CanonicalTileID &p); bool operator==(const Leaf &other) const; - std::set children; + std::unordered_set children; ClipID& clip; }; uint8_t bit_offset = 0; - std::multimap pool; + std::unordered_multimap pool; public: template diff --git a/src/mbgl/geometry/line_atlas.hpp b/src/mbgl/geometry/line_atlas.hpp index a2bda7186..7658ed33c 100644 --- a/src/mbgl/geometry/line_atlas.hpp +++ b/src/mbgl/geometry/line_atlas.hpp @@ -5,7 +5,7 @@ #include #include -#include +#include namespace mbgl { @@ -47,7 +47,7 @@ private: bool dirty; mbgl::optional texture; int nextRow = 0; - std::map positions; + std::unordered_map positions; }; } // namespace mbgl diff --git a/src/mbgl/gl/gl.cpp b/src/mbgl/gl/gl.cpp index 7747717c6..309785140 100644 --- a/src/mbgl/gl/gl.cpp +++ b/src/mbgl/gl/gl.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include namespace mbgl { @@ -98,15 +98,15 @@ void checkError(const char *cmd, const char *file, int line) { #undef glBufferData static unsigned int currentUsedBytes = 0; static GLint currentBoundTexture = 0; -static std::map bindingToSizeMap; +static std::unordered_map bindingToSizeMap; static GLuint currentArrayBuffer = 0; static GLuint currentElementArrayBuffer = 0; -static std::map bufferBindingToSizeMap; +static std::unordered_map bufferBindingToSizeMap; static unsigned int currentUsedBufferBytes = 0; static unsigned int largestAmountUsedSoFar = 0; -static std::map vertexArrayToArrayBufferMap; +static std::unordered_map vertexArrayToArrayBufferMap; static GLuint currentVertexArray = 0; static std::mutex gDebugMutex; diff --git a/src/mbgl/renderer/symbol_bucket.hpp b/src/mbgl/renderer/symbol_bucket.hpp index 8f0c21bc9..988cf5db2 100644 --- a/src/mbgl/renderer/symbol_bucket.hpp +++ b/src/mbgl/renderer/symbol_bucket.hpp @@ -45,7 +45,6 @@ public: const bool iconsNeedLinear; private: - friend class SymbolLayout; typedef ElementGroup<2> TextElementGroup; typedef ElementGroup<4> IconElementGroup; diff --git a/src/mbgl/style/paint_property.hpp b/src/mbgl/style/paint_property.hpp index 070751616..4a620706e 100644 --- a/src/mbgl/style/paint_property.hpp +++ b/src/mbgl/style/paint_property.hpp @@ -10,7 +10,7 @@ #include #include -#include +#include #include namespace mbgl { @@ -96,8 +96,8 @@ public: private: T defaultValue; - std::map> values; - std::map transitions; + std::unordered_map> values; + std::unordered_map transitions; struct CascadedValue { CascadedValue(std::unique_ptr prior_, diff --git a/src/mbgl/tile/tile_id.hpp b/src/mbgl/tile/tile_id.hpp index f561db9a4..88b01269e 100644 --- a/src/mbgl/tile/tile_id.hpp +++ b/src/mbgl/tile/tile_id.hpp @@ -8,6 +8,7 @@ #include #include #include +#include namespace mbgl { @@ -254,3 +255,36 @@ inline float UnwrappedTileID::pixelsToTileUnits(const float pixelValue, const fl } } // namespace mbgl + +namespace std { + +template <> struct hash { + 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 { + size_t operator()(const mbgl::UnwrappedTileID &id) const { + std::size_t seed = 0; + boost::hash_combine(seed, std::hash{}(id.canonical)); + boost::hash_combine(seed, id.wrap); + return seed; + } +}; + +template <> struct hash { + size_t operator()(const mbgl::OverscaledTileID &id) const { + std::size_t seed = 0; + boost::hash_combine(seed, std::hash{}(id.canonical)); + boost::hash_combine(seed, id.overscaledZ); + return seed; + } +}; + +} // namespace std + diff --git a/src/mbgl/tile/vector_tile.cpp b/src/mbgl/tile/vector_tile.cpp index 4a1f60711..bde0b4f63 100644 --- a/src/mbgl/tile/vector_tile.cpp +++ b/src/mbgl/tile/vector_tile.cpp @@ -5,7 +5,7 @@ #include -#include +#include #include #include #include @@ -49,7 +49,7 @@ private: std::string name; uint32_t version = 1; uint32_t extent = 4096; - std::map keysMap; + std::unordered_map keysMap; std::vector> keys; std::vector values; std::vector features; @@ -68,7 +68,7 @@ public: private: std::shared_ptr data; mutable bool parsed = false; - mutable std::map layers; + mutable std::unordered_map layers; }; VectorTile::VectorTile(const OverscaledTileID& id_, diff --git a/src/mbgl/util/merge_lines.cpp b/src/mbgl/util/merge_lines.cpp index 0f2a955e9..663f757dc 100644 --- a/src/mbgl/util/merge_lines.cpp +++ b/src/mbgl/util/merge_lines.cpp @@ -5,7 +5,7 @@ namespace mbgl { namespace util { -using Index = std::map; +using Index = std::unordered_map; unsigned int mergeFromRight(std::vector &features, Index &rightIndex, diff --git a/src/mbgl/util/merge_lines.hpp b/src/mbgl/util/merge_lines.hpp index 8db8c284c..bb4c01f6a 100644 --- a/src/mbgl/util/merge_lines.hpp +++ b/src/mbgl/util/merge_lines.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include #include #include #include @@ -9,15 +9,15 @@ namespace mbgl { namespace util { unsigned int mergeFromRight(std::vector &features, - std::map &rightIndex, - std::map::iterator left, + std::unordered_map &rightIndex, + std::unordered_map::iterator left, std::string &rightKey, GeometryCollection &geom); unsigned int mergeFromLeft(std::vector &features, - std::map &leftIndex, + std::unordered_map &leftIndex, std::string &leftKey, - std::map::iterator right, + std::unordered_map::iterator right, GeometryCollection &geom); void mergeLines(std::vector &features); diff --git a/test/src/mbgl/test/conversion_stubs.hpp b/test/src/mbgl/test/conversion_stubs.hpp index 60f110ea0..63ed4e8b7 100644 --- a/test/src/mbgl/test/conversion_stubs.hpp +++ b/test/src/mbgl/test/conversion_stubs.hpp @@ -6,14 +6,14 @@ #include #include -#include +#include namespace mbgl { namespace style { namespace conversion { class Value; -using ValueMap = std::map; +using ValueMap = std::unordered_map; using ValueVector = std::vector; class Value : public mbgl::variant { using variant::variant;