From 88555e72850219a121ece09e9ea0a269392efee4 Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Tue, 26 Feb 2013 11:25:49 +0100 Subject: [PATCH] KeyValueDBMemory.cc: use empty() instead of size() == 0 Use empty() since it should be prefered as it has, following the standard, a constant time complexity regardless of the containter type. The same is not guaranteed for size(). Signed-off-by: Danny Al-Gaaf --- src/test/ObjectMap/KeyValueDBMemory.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/ObjectMap/KeyValueDBMemory.cc b/src/test/ObjectMap/KeyValueDBMemory.cc index 87671ccb1a7a..43fa60c47a1d 100644 --- a/src/test/ObjectMap/KeyValueDBMemory.cc +++ b/src/test/ObjectMap/KeyValueDBMemory.cc @@ -30,7 +30,7 @@ public: virtual ~WholeSpaceMemIterator() { } int seek_to_first() { - if (db->db.size() == 0) { + if (db->db.empty()) { it = db->db.end(); ready = false; return 0; @@ -42,7 +42,7 @@ public: int seek_to_first(const string &prefix) { it = db->db.lower_bound(make_pair(prefix, "")); - if ((db->db.size() == 0) || (it == db->db.end())) { + if (db->db.empty() || (it == db->db.end())) { it = db->db.end(); ready = false; return 0; @@ -53,7 +53,7 @@ public: int seek_to_last() { it = db->db.end(); - if (db->db.size() == 0) { + if (db->db.empty()) { ready = false; return 0; } @@ -68,7 +68,7 @@ public: tmp.append(1, (char) 0); it = db->db.upper_bound(make_pair(tmp,"")); - if ((db->db.size() == 0) || (it == db->db.end())) { + if (db->db.empty() || (it == db->db.end())) { seek_to_last(); } else { -- 2.47.3