diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-05-11 13:01:59 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-05-12 08:36:30 -0700 |
commit | e79858558d9bdcd3c7366c75be8c160cc939ff2a (patch) | |
tree | 5892f854c6f897816207964edcf93670286272ec | |
parent | e6296479f017145df47daea8ed19b440dc70eedc (diff) | |
download | qtlocation-mapboxgl-e79858558d9bdcd3c7366c75be8c160cc939ff2a.tar.gz |
[core] Avoid instantiating temporary vector
-rw-r--r-- | src/mbgl/text/collision_tile.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/mbgl/text/collision_tile.cpp b/src/mbgl/text/collision_tile.cpp index 2a2d4083e7..c9ae7ab8e0 100644 --- a/src/mbgl/text/collision_tile.cpp +++ b/src/mbgl/text/collision_tile.cpp @@ -85,11 +85,8 @@ float CollisionTile::placeFeature(const CollisionFeature& feature, const bool al const auto anchor = util::matrixMultiply(rotationMatrix, box.anchor); if (!allowOverlap) { - std::vector<CollisionTreeBox> blockingBoxes; - tree.query(bgi::intersects(getTreeBox(anchor, box)), std::back_inserter(blockingBoxes)); - - for (auto& blockingTreeBox : blockingBoxes) { - const auto& blocking = std::get<1>(blockingTreeBox); + for (auto it = tree.qbegin(bgi::intersects(getTreeBox(anchor, box))); it != tree.qend(); ++it) { + const auto& blocking = std::get<1>(*it); auto blockingAnchor = util::matrixMultiply(rotationMatrix, blocking.anchor); minPlacementScale = findPlacementScale(minPlacementScale, anchor, box, blockingAnchor, blocking); |