summaryrefslogtreecommitdiff
path: root/src/mbgl/renderer/frame_history.cpp
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2015-07-07 19:37:22 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2015-07-29 11:03:47 +0300
commit58b93553c10b77eedd573104b56d63916c635cbb (patch)
tree368648b8ec4af1c82f5dde5f66747975fd04d86c /src/mbgl/renderer/frame_history.cpp
parent807d87f0f5883e1c697433eca381c860a74596f2 (diff)
downloadqtlocation-mapboxgl-58b93553c10b77eedd573104b56d63916c635cbb.tar.gz
Replace size() with empty() whenever possible
Before C++11, std::list's implementation of size was O(n). It should be all O(1) now, but it is probably still a good idea to use empty() to emphasize the intend.
Diffstat (limited to 'src/mbgl/renderer/frame_history.cpp')
-rw-r--r--src/mbgl/renderer/frame_history.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mbgl/renderer/frame_history.cpp b/src/mbgl/renderer/frame_history.cpp
index 73336c029f..c95e82631e 100644
--- a/src/mbgl/renderer/frame_history.cpp
+++ b/src/mbgl/renderer/frame_history.cpp
@@ -5,18 +5,18 @@ using namespace mbgl;
// Record frame history that will be used to calculate fading params
void FrameHistory::record(const TimePoint& now, float zoom) {
// first frame ever
- if (!history.size()) {
+ if (history.empty()) {
history.emplace_back(FrameSnapshot{TimePoint::min(), zoom});
history.emplace_back(FrameSnapshot{TimePoint::min(), zoom});
}
- if (history.size() > 0 || history.back().z != zoom) {
+ if (!history.empty() || history.back().z != zoom) {
history.emplace_back(FrameSnapshot{now, zoom});
}
}
bool FrameHistory::needsAnimation(const Duration& duration) const {
- if (!history.size()) {
+ if (history.empty()) {
return false;
}