From: Sage Weil Date: Tue, 18 Mar 2014 04:41:40 +0000 (-0700) Subject: common/PrioritizedQueue: constify a few things X-Git-Tag: v0.79~109^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=de576d5b0bee5350f074621e41782ddd0a0eec30;p=ceph.git common/PrioritizedQueue: constify a few things Signed-off-by: Sage Weil --- diff --git a/src/common/PrioritizedQueue.h b/src/common/PrioritizedQueue.h index 28a9f7a4cd7f..e5557e608fb0 100644 --- a/src/common/PrioritizedQueue.h +++ b/src/common/PrioritizedQueue.h @@ -230,15 +230,15 @@ public: min_cost(min_c) {} - unsigned length() { + unsigned length() const { unsigned total = 0; - for (typename map::iterator i = queue.begin(); + for (typename map::const_iterator i = queue.begin(); i != queue.end(); ++i) { assert(i->second.length()); total += i->second.length(); } - for (typename map::iterator i = high_queue.begin(); + for (typename map::const_iterator i = high_queue.begin(); i != high_queue.end(); ++i) { assert(i->second.length()); @@ -323,7 +323,7 @@ public: create_queue(priority)->enqueue_front(cl, cost, item); } - bool empty() { + bool empty() const { assert(total_priority >= 0); assert((total_priority == 0) || !(queue.empty())); return queue.empty() && high_queue.empty();