summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-09-03 16:21:08 (GMT)
committerDennis Nienhüser <nienhueser@kde.org>2016-09-03 16:21:08 (GMT)
commit38e91e8eeddbab817b37f38e7b69bb623cc52035 (patch)
tree3de7ef9eb815f07ce64b50b43fe5196707177878
parent017a680a06c7e110c3ed9a6ac65930d9a7340745 (diff)
Cache iterator end
-rw-r--r--tools/osm-simplify/NodeReducer.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/tools/osm-simplify/NodeReducer.h b/tools/osm-simplify/NodeReducer.h
index fc49320..7ea64f6 100644
--- a/tools/osm-simplify/NodeReducer.h
+++ b/tools/osm-simplify/NodeReducer.h
@@ -32,17 +32,17 @@ private:
}
T* reducedLine = new T;
- QVector<GeoDataCoordinates>::iterator itCoords = lineString->begin();
- GeoDataCoordinates currentCoords = *itCoords;
- reducedLine->append(*itCoords);
- ++itCoords;
- for (; itCoords != (lineString->end() - 1); ++itCoords) {
- if (distanceSphere( currentCoords, *itCoords ) >= m_resolution) {
- currentCoords = *itCoords;
- reducedLine->append(*itCoords);
+ auto iter = lineString->begin();
+ GeoDataCoordinates currentCoords = *iter;
+ reducedLine->append(*iter);
+ ++iter;
+ for (auto const end = lineString->end() - 1; iter != end; ++iter) {
+ if (distanceSphere( currentCoords, *iter ) >= m_resolution) {
+ currentCoords = *iter;
+ reducedLine->append(*iter);
}
}
- reducedLine->append(*itCoords);
+ reducedLine->append(*iter);
qint64 reducedSize = reducedLine->size();
m_count += (prevSize - reducedSize);