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/text | |
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/text')
-rw-r--r-- | src/mbgl/text/font_stack.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/text/get_anchors.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/text/glyph.hpp | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/src/mbgl/text/font_stack.cpp b/src/mbgl/text/font_stack.cpp index 7785a14238..d4d3a39475 100644 --- a/src/mbgl/text/font_stack.cpp +++ b/src/mbgl/text/font_stack.cpp @@ -39,7 +39,7 @@ const Shaping FontStack::getShaping(const std::u32string &string, const float ma } } - if (!shaping.positionedGlyphs.size()) + if (shaping.positionedGlyphs.empty()) return shaping; lineWrap(shaping, lineHeight, maxWidth, horizontalAlign, verticalAlign, justify); diff --git a/src/mbgl/text/get_anchors.cpp b/src/mbgl/text/get_anchors.cpp index e86dba4017..ef8a75c02e 100644 --- a/src/mbgl/text/get_anchors.cpp +++ b/src/mbgl/text/get_anchors.cpp @@ -43,7 +43,7 @@ Anchors resample(const std::vector<Coordinate> &line, const float offset, const distance += segmentDist; } - if (!placeAtMiddle && !anchors.size() && !continuedLine) { + if (!placeAtMiddle && anchors.empty() && !continuedLine) { // The first attempt at finding anchors at which labels can be placed failed. // Try again, but this time just try placing one anchor at the middle of the line. // This has the most effect for short lines in overscaled tiles, since the diff --git a/src/mbgl/text/glyph.hpp b/src/mbgl/text/glyph.hpp index 334e1428c3..d1ba71c767 100644 --- a/src/mbgl/text/glyph.hpp +++ b/src/mbgl/text/glyph.hpp @@ -67,7 +67,7 @@ class Shaping { int32_t left; int32_t right; - operator bool() const { return positionedGlyphs.size(); } + operator bool() const { return !positionedGlyphs.empty(); } }; class SDFGlyph { |