diff --git a/platform/default/src/mbgl/storage/file_source_request.cpp b/platform/default/src/mbgl/storage/file_source_request.cpp index 667cbf345..c8d5ae46a 100644 --- a/platform/default/src/mbgl/storage/file_source_request.cpp +++ b/platform/default/src/mbgl/storage/file_source_request.cpp @@ -24,7 +24,7 @@ void FileSourceRequest::onCancel(std::function&& callback) { void FileSourceRequest::setResponse(const Response& response) { // Copy, because calling the callback will sometimes self // destroy this object. We cannot move because this method - // can be called more than one. + // can be called more than once. auto callback = responseCallback; callback(response); } diff --git a/src/mbgl/geometry/feature_index.cpp b/src/mbgl/geometry/feature_index.cpp index 240c61136..d4fd47b30 100644 --- a/src/mbgl/geometry/feature_index.cpp +++ b/src/mbgl/geometry/feature_index.cpp @@ -33,6 +33,90 @@ mbgl::Point project(const mbgl::LatLng& coordinate, const mbgl::Transfor namespace mbgl { +constexpr auto expectedUniqueLayerIDs = 10; +constexpr auto expectedUniqueLeaderIDs = 30; + +RefIndexedSubfeature::RefIndexedSubfeature(std::size_t index_, + const std::string& sourceLayerName_, + const std::string& bucketName_, + size_t sortIndex_, + uint32_t bucketInstanceId_, + uint16_t collisionGroupId_) + : index(index_), + sortIndex(sortIndex_), + sourceLayerName(sourceLayerName_), + bucketLeaderID(bucketName_), + bucketInstanceId(bucketInstanceId_), + collisionGroupId(collisionGroupId_) {} + +IndexedSubfeature::IndexedSubfeature(const RefIndexedSubfeature& other) + : IndexedSubfeature(other, other.getBucketInstanceId(), other.getCollisionGroupId()) {} + +IndexedSubfeature::IndexedSubfeature(const RefIndexedSubfeature& other, + uint32_t bucketInstanceId_, + uint16_t collisionGroupId_) + : IndexedSubfeature(other.getIndex(), + other.getSourceLayerName(), + other.getBucketLeaderID(), + other.getSortIndex(), + bucketInstanceId_, + collisionGroupId_) {} + +IndexedSubfeature::IndexedSubfeature(const IndexedSubfeature& other) + : IndexedSubfeature(other.getIndex(), + other.sourceLayerName, + other.bucketLeaderID, + other.getSortIndex(), + other.getBucketInstanceId(), + other.getCollisionGroupId()) {} + +IndexedSubfeature::IndexedSubfeature(IndexedSubfeature&& other) + : IndexedSubfeature(other.getIndex(), + std::move(other.sourceLayerName), + std::move(other.bucketLeaderID), + other.getSortIndex(), + other.getBucketInstanceId(), + other.getCollisionGroupId()) {} + +IndexedSubfeature::IndexedSubfeature(std::size_t index_, + std::string sourceLayerName_, + std::string bucketName_, + size_t sortIndex_, + uint32_t bucketInstanceId_, + uint16_t collisionGroupId_) + : RefIndexedSubfeature(index_, + this->sourceLayerNameCopy, + this->bucketLeaderIDCopy, + sortIndex_, + bucketInstanceId_, + collisionGroupId_), + sourceLayerNameCopy(std::move(sourceLayerName_)), + bucketLeaderIDCopy(std::move(bucketName_)) {} + +IndexedSubfeature& IndexedSubfeature::operator=(const IndexedSubfeature& other) { + index = other.index; + sourceLayerName = sourceLayerNameCopy; + bucketLeaderID = bucketLeaderIDCopy; + sortIndex = other.sortIndex; + bucketInstanceId = other.bucketInstanceId; + collisionGroupId = other.collisionGroupId; + sourceLayerNameCopy = other.sourceLayerNameCopy; + bucketLeaderIDCopy = other.bucketLeaderIDCopy; + return *this; +} + +IndexedSubfeature& IndexedSubfeature::operator=(IndexedSubfeature&& other) { + index = other.index; + sourceLayerName = sourceLayerNameCopy; + bucketLeaderID = bucketLeaderIDCopy; + sortIndex = other.sortIndex; + bucketInstanceId = other.bucketInstanceId; + collisionGroupId = other.collisionGroupId; + sourceLayerNameCopy = std::move(other.sourceLayerNameCopy); + bucketLeaderIDCopy = std::move(other.bucketLeaderIDCopy); + return *this; +} + FeatureIndex::FeatureIndex(std::unique_ptr tileData_) : grid(util::EXTENT, util::EXTENT, util::EXTENT / 16), // 16x16 grid -> 32px cell tileData(std::move(tileData_)) {} @@ -41,12 +125,22 @@ void FeatureIndex::insert(const GeometryCollection& geometries, std::size_t index, const std::string& sourceLayerName, const std::string& bucketLeaderID) { + if (uniqueLayerIDs.empty()) { + uniqueLayerIDs.reserve(expectedUniqueLayerIDs); + } + const std::string& emplacedLayerName = *uniqueLayerIDs.insert(sourceLayerName).first; + if (bucketLayerIDs.empty()) { + bucketLayerIDs.reserve(expectedUniqueLeaderIDs); + } + const std::string& emplacedLeaderID = + bucketLayerIDs.insert(std::make_pair(bucketLeaderID, std::vector{})).first->first; + auto featureSortIndex = sortIndex++; for (const auto& ring : geometries) { - auto envelope = mapbox::geometry::envelope(ring); + const auto envelope = mapbox::geometry::envelope(ring); if (envelope.min.x < util::EXTENT && envelope.min.y < util::EXTENT && envelope.max.x >= 0 && envelope.max.y >= 0) { - grid.insert(IndexedSubfeature(index, sourceLayerName, bucketLeaderID, featureSortIndex), + grid.insert(RefIndexedSubfeature(index, emplacedLayerName, emplacedLeaderID, featureSortIndex), {convertPoint(envelope.min), convertPoint(envelope.max)}); } } @@ -74,17 +168,17 @@ void FeatureIndex::query(std::unordered_map>& // Query the grid index mapbox::geometry::box box = mapbox::geometry::envelope(queryGeometry); - std::vector features = grid.query( + std::vector features = grid.query( {convertPoint(box.min - additionalPadding), convertPoint(box.max + additionalPadding)}); - std::sort(features.begin(), features.end(), [](const IndexedSubfeature& a, const IndexedSubfeature& b) { - return a.sortIndex > b.sortIndex; + std::sort(features.begin(), features.end(), [](const RefIndexedSubfeature& a, const RefIndexedSubfeature& b) { + return a.getSortIndex() > b.getSortIndex(); }); size_t previousSortIndex = std::numeric_limits::max(); for (const auto& indexedFeature : features) { // If this feature is the same as the previous feature, skip it. - if (indexedFeature.sortIndex == previousSortIndex) continue; - previousSortIndex = indexedFeature.sortIndex; + if (indexedFeature.getSortIndex() == previousSortIndex) continue; + previousSortIndex = indexedFeature.getSortIndex(); addFeature(result, indexedFeature, @@ -109,11 +203,12 @@ std::unordered_map> FeatureIndex::lookupSymbol if (!tileData) { return result; } - std::vector sortedFeatures(symbolFeatures.begin(), symbolFeatures.end()); + std::vector> sortedFeatures(symbolFeatures.begin(), + symbolFeatures.end()); std::sort(sortedFeatures.begin(), sortedFeatures.end(), - [featureSortOrder](const IndexedSubfeature& a, const IndexedSubfeature& b) { + [featureSortOrder](const RefIndexedSubfeature& a, const RefIndexedSubfeature& b) { // Same idea as the non-symbol sort order, but symbol features may // have changed their sort order since their corresponding // IndexedSubfeature was added to the CollisionIndex The @@ -124,15 +219,15 @@ std::unordered_map> FeatureIndex::lookupSymbol // "top-to-bottom" rendering order (aka last-to-first). // Actually there can be multiple symbol instances per feature, so // we sort each feature based on the first matching symbol instance. - auto sortedA = std::find(featureSortOrder->begin(), featureSortOrder->end(), a.index); - auto sortedB = std::find(featureSortOrder->begin(), featureSortOrder->end(), b.index); + auto sortedA = std::find(featureSortOrder->begin(), featureSortOrder->end(), a.getIndex()); + auto sortedB = std::find(featureSortOrder->begin(), featureSortOrder->end(), b.getIndex()); assert(sortedA != featureSortOrder->end()); assert(sortedB != featureSortOrder->end()); return sortedA > sortedB; } else { // Bucket hasn't been re-sorted based on angle, so use same // "reverse of appearance in source data" logic as non-symboles - return a.sortIndex > b.sortIndex; + return a.getSortIndex() > b.getSortIndex(); } }); @@ -153,7 +248,7 @@ std::unordered_map> FeatureIndex::lookupSymbol } void FeatureIndex::addFeature(std::unordered_map>& result, - const IndexedSubfeature& indexedFeature, + const RefIndexedSubfeature& indexedFeature, const RenderedQueryOptions& options, const CanonicalTileID& tileID, const std::unordered_map& layers, @@ -166,7 +261,7 @@ void FeatureIndex::addFeature(std::unordered_map sourceLayer; std::unique_ptr geometryTileFeature; - for (const std::string& layerID : bucketLayerIDs.at(indexedFeature.bucketLeaderID)) { + for (const std::string& layerID : bucketLayerIDs.at(indexedFeature.getBucketLeaderID())) { const auto it = layers.find(layerID); if (it == layers.end()) { continue; @@ -175,10 +270,10 @@ void FeatureIndex::addFeature(std::unordered_mapsecond; if (!geometryTileFeature) { - sourceLayer = tileData->getLayer(indexedFeature.sourceLayerName); + sourceLayer = tileData->getLayer(indexedFeature.getSourceLayerName()); assert(sourceLayer); - geometryTileFeature = sourceLayer->getFeature(indexedFeature.index); + geometryTileFeature = sourceLayer->getFeature(indexedFeature.getIndex()); assert(geometryTileFeature); } FeatureState state; @@ -226,6 +321,8 @@ std::optional FeatureIndex::translateQueryGeometry(const Ge } GeometryCoordinates translated; + translated.reserve(queryGeometry.size()); + for (const auto& p : queryGeometry) { translated.push_back(p - translateVec); } @@ -233,6 +330,9 @@ std::optional FeatureIndex::translateQueryGeometry(const Ge } void FeatureIndex::setBucketLayerIDs(const std::string& bucketLeaderID, const std::vector& layerIDs) { + if (bucketLayerIDs.empty()) { + bucketLayerIDs.reserve(expectedUniqueLeaderIDs); + } bucketLayerIDs[bucketLeaderID] = layerIDs; } @@ -249,6 +349,7 @@ void DynamicFeatureIndex::query(std::unordered_map coord = {int64_t(pm.x), int64_t(pm.y)}; mbgl::updateBBox(queryBox, coord); } + for (const auto& f : features) { // hit testing mbgl::GeometryBBox featureBox = DefaultWithinBBox; diff --git a/src/mbgl/geometry/feature_index.hpp b/src/mbgl/geometry/feature_index.hpp index 01aa6d505..2b7c02a60 100644 --- a/src/mbgl/geometry/feature_index.hpp +++ b/src/mbgl/geometry/feature_index.hpp @@ -21,34 +21,69 @@ class SourceFeatureState; class CollisionIndex; -class IndexedSubfeature { +/// An indexed element within a feature index. +/// This version holds a reference to the strings within the index itself to avoid making tens of thousands of +/// unnecessary copies of them. As a result, its lifetime cannot exceed that of the index. +class RefIndexedSubfeature { public: - IndexedSubfeature() = delete; - IndexedSubfeature(std::size_t index_, std::string sourceLayerName_, std::string bucketName_, size_t sortIndex_) - : index(index_), - sourceLayerName(std::move(sourceLayerName_)), - bucketLeaderID(std::move(bucketName_)), - sortIndex(sortIndex_), - bucketInstanceId(0), - collisionGroupId(0) {} + RefIndexedSubfeature() = delete; + RefIndexedSubfeature(RefIndexedSubfeature&&) = default; + RefIndexedSubfeature(const RefIndexedSubfeature&) = default; + RefIndexedSubfeature(std::size_t index_, + const std::string& sourceLayerName_, + const std::string& bucketName_, + size_t sortIndex_, + uint32_t bucketInstanceId_ = 0, + uint16_t collisionGroupId_ = 0); - IndexedSubfeature(const IndexedSubfeature& other, uint32_t bucketInstanceId_, uint16_t collisionGroupId_) - : index(other.index), - sourceLayerName(other.sourceLayerName), - bucketLeaderID(other.bucketLeaderID), - sortIndex(other.sortIndex), - bucketInstanceId(bucketInstanceId_), - collisionGroupId(collisionGroupId_) {} + RefIndexedSubfeature& operator=(const RefIndexedSubfeature&) = default; + RefIndexedSubfeature& operator=(RefIndexedSubfeature&&) = default; + + size_t getIndex() const { return index; } + size_t getSortIndex() const { return sortIndex; } + + const std::string& getSourceLayerName() const { return sourceLayerName.get(); } + const std::string& getBucketLeaderID() const { return bucketLeaderID.get(); } + + uint32_t getBucketInstanceId() const { return bucketInstanceId; } + uint16_t getCollisionGroupId() const { return collisionGroupId; } + +protected: size_t index; - std::string sourceLayerName; - std::string bucketLeaderID; size_t sortIndex; + std::reference_wrapper sourceLayerName; + std::reference_wrapper bucketLeaderID; + // Only used for symbol features uint32_t bucketInstanceId; uint16_t collisionGroupId; }; +/// This version of an indexed feature has copies of the necessary strings, so that it can be used outside the index. +class IndexedSubfeature : public RefIndexedSubfeature { +public: + IndexedSubfeature(const RefIndexedSubfeature&); + IndexedSubfeature(const RefIndexedSubfeature&, uint32_t bucketInstanceId_, uint16_t collisionGroupId_); + + IndexedSubfeature(const IndexedSubfeature&); + IndexedSubfeature(IndexedSubfeature&&); + + IndexedSubfeature(std::size_t index_, + std::string sourceLayerName_, + std::string bucketName_, + size_t sortIndex_, + uint32_t bucketInstanceId_ = 0, + uint16_t collisionGroupId_ = 0); + + IndexedSubfeature& operator=(const IndexedSubfeature&); + IndexedSubfeature& operator=(IndexedSubfeature&&); + +private: + std::string sourceLayerNameCopy; + std::string bucketLeaderIDCopy; +}; + using FeatureSortOrder = std::shared_ptr>; class DynamicFeatureIndex { @@ -112,7 +147,7 @@ public: private: void addFeature(std::unordered_map>& result, - const IndexedSubfeature&, + const RefIndexedSubfeature&, const RenderedQueryOptions& options, const CanonicalTileID&, const std::unordered_map&, @@ -122,10 +157,15 @@ private: const mat4& posMatrix, const SourceFeatureState* sourceFeatureState) const; - GridIndex grid; + GridIndex grid; unsigned int sortIndex = 0; + // mbgl::unordered_* cannot be used here, as we rely on holding references to elements: + // 22.2.7 Unordered associative containers [unord.req] + // The insert and emplace members shall not affect the validity of references to + // container elements, but may invalidate all iterators to the container. std::unordered_map> bucketLayerIDs; + std::unordered_set uniqueLayerIDs; std::unique_ptr tileData; }; } // namespace mbgl diff --git a/src/mbgl/layout/symbol_instance.cpp b/src/mbgl/layout/symbol_instance.cpp index 9b48b0de2..024479566 100644 --- a/src/mbgl/layout/symbol_instance.cpp +++ b/src/mbgl/layout/symbol_instance.cpp @@ -87,7 +87,7 @@ SymbolInstance::SymbolInstance(Anchor& anchor_, const float iconBoxScale, const float iconPadding, const std::array& iconOffset_, - const IndexedSubfeature& indexedFeature, + const RefIndexedSubfeature& indexedFeature, const std::size_t layoutFeatureIndex_, const std::size_t dataFeatureIndex_, std::u16string key_, diff --git a/src/mbgl/layout/symbol_instance.hpp b/src/mbgl/layout/symbol_instance.hpp index 2082b6d2a..3d57d1d71 100644 --- a/src/mbgl/layout/symbol_instance.hpp +++ b/src/mbgl/layout/symbol_instance.hpp @@ -66,7 +66,7 @@ public: float iconBoxScale, float iconPadding, const std::array& iconOffset, - const IndexedSubfeature& indexedFeature, + const RefIndexedSubfeature& indexedFeature, std::size_t layoutFeatureIndex, std::size_t dataFeatureIndex, std::u16string key, diff --git a/src/mbgl/renderer/layers/render_symbol_layer.cpp b/src/mbgl/renderer/layers/render_symbol_layer.cpp index cadb9d2f3..9a8af217d 100644 --- a/src/mbgl/renderer/layers/render_symbol_layer.cpp +++ b/src/mbgl/renderer/layers/render_symbol_layer.cpp @@ -1206,13 +1206,15 @@ void RenderSymbolLayer::update(gfx::ShaderRegistry& shaders, // We'll be processing renderables across tiles, potentially out-of-order, so keep // track of some things by tile ID so we don't have to re-build them multiple times. - using RawVertexVec = std::vector; // + using RawVertexVec = std::vector; // raw buffer for vertexes of struct TileInfo { RawVertexVec textVertices, iconVertices; gfx::DrawableTweakerPtr textTweaker, iconTweaker; gfx::UniformBufferPtr textInterp, iconInterp; }; + std::unordered_map tileCache; + tileCache.reserve(renderTiles->size()); for (auto& group : renderableSegments) { const auto& renderable = group.renderable; diff --git a/src/mbgl/text/collision_feature.hpp b/src/mbgl/text/collision_feature.hpp index dd272a48d..29f63ac25 100644 --- a/src/mbgl/text/collision_feature.hpp +++ b/src/mbgl/text/collision_feature.hpp @@ -87,7 +87,7 @@ public: const float boxScale, const float padding, const style::SymbolPlacementType placement, - const IndexedSubfeature& indexedFeature_, + const RefIndexedSubfeature& indexedFeature_, const float overscaling, const float rotate) : CollisionFeature(line, @@ -117,7 +117,7 @@ public: std::optional shapedIcon, const float boxScale, const float padding, - const IndexedSubfeature& indexedFeature_, + const RefIndexedSubfeature& indexedFeature_, const float rotate) : CollisionFeature(line, anchor, diff --git a/src/mbgl/text/collision_index.cpp b/src/mbgl/text/collision_index.cpp index 3a7512150..c4d318087 100644 --- a/src/mbgl/text/collision_index.cpp +++ b/src/mbgl/text/collision_index.cpp @@ -159,7 +159,7 @@ std::pair CollisionIndex::placeFeature( const bool pitchWithMap, const bool collisionDebug, const std::optional& avoidEdges, - const std::optional>& collisionGroupPredicate, + const std::optional>& collisionGroupPredicate, std::vector& projectedBoxes) { assert(projectedBoxes.empty()); if (!feature.alongLine) { @@ -202,7 +202,7 @@ std::pair CollisionIndex::placeLineFeature( const bool pitchWithMap, const bool collisionDebug, const std::optional& avoidEdges, - const std::optional>& collisionGroupPredicate, + const std::optional>& collisionGroupPredicate, std::vector& projectedBoxes) { assert(feature.alongLine); assert(projectedBoxes.empty()); @@ -340,10 +340,10 @@ void CollisionIndex::insertFeature(const CollisionFeature& feature, } if (ignorePlacement) { - ignoredGrid.insert(IndexedSubfeature(feature.indexedFeature, bucketInstanceId, collisionGroupId), + ignoredGrid.insert(IndexedSubfeature{feature.indexedFeature, bucketInstanceId, collisionGroupId}, circle.circle()); } else { - collisionGrid.insert(IndexedSubfeature(feature.indexedFeature, bucketInstanceId, collisionGroupId), + collisionGrid.insert(IndexedSubfeature{feature.indexedFeature, bucketInstanceId, collisionGroupId}, circle.circle()); } } @@ -352,10 +352,10 @@ void CollisionIndex::insertFeature(const CollisionFeature& feature, auto& box = projectedBoxes[0]; assert(box.isBox()); if (ignorePlacement) { - ignoredGrid.insert(IndexedSubfeature(feature.indexedFeature, bucketInstanceId, collisionGroupId), + ignoredGrid.insert(IndexedSubfeature{feature.indexedFeature, bucketInstanceId, collisionGroupId}, box.box()); } else { - collisionGrid.insert(IndexedSubfeature(feature.indexedFeature, bucketInstanceId, collisionGroupId), + collisionGrid.insert(IndexedSubfeature{feature.indexedFeature, bucketInstanceId, collisionGroupId}, box.box()); } } @@ -398,23 +398,25 @@ std::unordered_map> CollisionIndex::que std::vector features = collisionGrid.queryWithBoxes(envelope); std::vector ignoredFeatures = ignoredGrid.queryWithBoxes(envelope); - features.insert(features.end(), ignoredFeatures.begin(), ignoredFeatures.end()); + features.insert(features.end(), + std::make_move_iterator(ignoredFeatures.begin()), + std::make_move_iterator(ignoredFeatures.end())); - std::unordered_map> seenBuckets; + mbgl::unordered_map> seenBuckets; for (auto& queryResult : features) { auto& feature = queryResult.first; auto& bbox = queryResult.second; // Skip already seen features. - auto& seenFeatures = seenBuckets[feature.bucketInstanceId]; - if (seenFeatures.find(feature.index) != seenFeatures.end()) continue; + auto& seenFeatures = seenBuckets[feature.getBucketInstanceId()]; + if (seenFeatures.find(feature.getIndex()) != seenFeatures.end()) continue; if (!polygonIntersectsBox(gridQuery, bbox)) { continue; } - seenFeatures.insert(feature.index); - result[feature.bucketInstanceId].push_back(feature); + seenFeatures.insert(feature.getIndex()); + result[feature.getBucketInstanceId()].push_back(feature); } return result; diff --git a/src/mbgl/text/collision_index.hpp b/src/mbgl/text/collision_index.hpp index ef11a660d..776e626e7 100644 --- a/src/mbgl/text/collision_index.hpp +++ b/src/mbgl/text/collision_index.hpp @@ -48,7 +48,7 @@ public: bool pitchWithMap, bool collisionDebug, const std::optional& avoidEdges, - const std::optional>& collisionGroupPredicate, + const std::optional>& collisionGroupPredicate, std::vector& /*out*/ ); @@ -84,7 +84,7 @@ private: bool pitchWithMap, bool collisionDebug, const std::optional& avoidEdges, - const std::optional>& collisionGroupPredicate, + const std::optional>& collisionGroupPredicate, std::vector& /*out*/ ); diff --git a/src/mbgl/text/placement.cpp b/src/mbgl/text/placement.cpp index e42b817d5..00148856a 100644 --- a/src/mbgl/text/placement.cpp +++ b/src/mbgl/text/placement.cpp @@ -49,8 +49,8 @@ const CollisionGroups::CollisionGroup& CollisionGroups::get(const std::string& s collisionGroups.emplace( sourceID, CollisionGroup(nextGroupID, - std::optional([nextGroupID](const IndexedSubfeature& feature) -> bool { - return feature.collisionGroupId == nextGroupID; + std::optional([nextGroupID](const RefIndexedSubfeature& feature) -> bool { + return feature.getCollisionGroupId() == nextGroupID; }))); } return collisionGroups[sourceID]; diff --git a/src/mbgl/text/placement.hpp b/src/mbgl/text/placement.hpp index d04a927b0..8fb3f11f4 100644 --- a/src/mbgl/text/placement.hpp +++ b/src/mbgl/text/placement.hpp @@ -77,7 +77,7 @@ struct RetainedQueryData { class CollisionGroups { public: - using Predicate = std::function; + using Predicate = std::function; using CollisionGroup = std::pair>; CollisionGroups(const bool crossSourceCollisions_) diff --git a/src/mbgl/tile/geometry_tile_worker.cpp b/src/mbgl/tile/geometry_tile_worker.cpp index 11bcf9631..5f23cffb9 100644 --- a/src/mbgl/tile/geometry_tile_worker.cpp +++ b/src/mbgl/tile/geometry_tile_worker.cpp @@ -363,7 +363,9 @@ void GeometryTileWorker::parse() { ImageDependencies imageDependencies; // Create render layers and group by layout - std::unordered_map>> groupMap; + mbgl::unordered_map>> groupMap; + groupMap.reserve(layers->size()); + for (auto layer : *layers) { groupMap[layoutKey(*layer->baseImpl)].push_back(std::move(layer)); } diff --git a/src/mbgl/util/grid_index.cpp b/src/mbgl/util/grid_index.cpp index a5b704c2d..7adb6d2c3 100644 --- a/src/mbgl/util/grid_index.cpp +++ b/src/mbgl/util/grid_index.cpp @@ -3,6 +3,6 @@ namespace mbgl { -template class GridIndex; +template class GridIndex; } // namespace mbgl diff --git a/src/mbgl/util/grid_index.hpp b/src/mbgl/util/grid_index.hpp index f7426e4b8..729b612dc 100644 --- a/src/mbgl/util/grid_index.hpp +++ b/src/mbgl/util/grid_index.hpp @@ -141,7 +141,7 @@ void GridIndex::insert(T&& t, const BBox& bbox) { } } - boxElements.emplace_back(t, bbox); + boxElements.emplace_back(std::move(t), bbox); } template @@ -164,7 +164,7 @@ void GridIndex::insert(T&& t, const BCircle& bcircle) { } } - circleElements.emplace_back(t, bcircle); + circleElements.emplace_back(std::move(t), bcircle); } template diff --git a/test/text/cross_tile_symbol_index.test.cpp b/test/text/cross_tile_symbol_index.test.cpp index b9377ba76..3f3ccf3d7 100644 --- a/test/text/cross_tile_symbol_index.test.cpp +++ b/test/text/cross_tile_symbol_index.test.cpp @@ -10,7 +10,7 @@ SymbolInstance makeSymbolInstance(float x, float y, std::u16string key) { ImageMap imageMap; const ShapedTextOrientations shaping{}; style::SymbolLayoutProperties::Evaluated layout_; - IndexedSubfeature subfeature(0, "", "", 0); + IndexedSubfeature subfeature(0, {}, {}, 0); Anchor anchor(x, y, 0, 0); std::array textOffset{{0.0f, 0.0f}}; std::array iconOffset{{0.0f, 0.0f}};