From b391bbe70f32c125645f39f299a906ff2aaaed9a Mon Sep 17 00:00:00 2001 From: Arne Juul Date: Fri, 5 Oct 2018 20:44:09 +0000 Subject: simplify slightly --- .../vespa/vespalib/metrics/point_map_collection.cpp | 20 ++------------------ .../vespa/vespalib/metrics/point_map_collection.h | 1 - 2 files changed, 2 insertions(+), 19 deletions(-) (limited to 'staging_vespalib') diff --git a/staging_vespalib/src/vespa/vespalib/metrics/point_map_collection.cpp b/staging_vespalib/src/vespa/vespalib/metrics/point_map_collection.cpp index 9909eb04cdc..892a1abcb36 100644 --- a/staging_vespalib/src/vespa/vespalib/metrics/point_map_collection.cpp +++ b/staging_vespalib/src/vespa/vespalib/metrics/point_map_collection.cpp @@ -25,24 +25,8 @@ HashedPointMap::operator< (const HashedPointMap &other) const if (_map.size() != other._map.size()) { return _map.size() < other._map.size(); } - // sizes equal, iterate in parallel - for (auto m = _map.begin(), o = other._map.begin(); - m != _map.end(); - ++m, ++o) - { - const Dimension& d1 = m->first; - const Dimension& d2 = o->first; - if (d1 != d2) { - return d1 < d2; - } - const Label &l1 = m->second; - const Label &l2 = o->second; - if (l1 != l2) { - return l1 < l2; - } - } - // equal - return false; + // sizes equal, fall back to std::map::operator< + return _map < other._map; } using Guard = std::lock_guard; diff --git a/staging_vespalib/src/vespa/vespalib/metrics/point_map_collection.h b/staging_vespalib/src/vespa/vespalib/metrics/point_map_collection.h index 3474bff6188..adbd7f53725 100644 --- a/staging_vespalib/src/vespa/vespalib/metrics/point_map_collection.h +++ b/staging_vespalib/src/vespa/vespalib/metrics/point_map_collection.h @@ -15,7 +15,6 @@ private: const PointMap _map; size_t _hash; public: - HashedPointMap() : _map(), _hash(0) {} HashedPointMap(PointMap &&from); bool operator< (const HashedPointMap &other) const; -- cgit v1.2.3