diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2015-07-07 19:37:22 +0300 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2015-07-29 11:03:47 +0300 |
commit | 58b93553c10b77eedd573104b56d63916c635cbb (patch) | |
tree | 368648b8ec4af1c82f5dde5f66747975fd04d86c /src/mbgl/renderer/frame_history.cpp | |
parent | 807d87f0f5883e1c697433eca381c860a74596f2 (diff) | |
download | qtlocation-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.cpp | 6 |
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; } |