From db42bcb306323d6221e7f893d39558c3db579bf3 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Tue, 19 Mar 2019 22:20:15 -0400 Subject: Fixes and corrections on formatting. --- src/common/multi_level_queue.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/common/multi_level_queue.h') diff --git a/src/common/multi_level_queue.h b/src/common/multi_level_queue.h index 68b35ffaa..2b61b91e0 100644 --- a/src/common/multi_level_queue.h +++ b/src/common/multi_level_queue.h @@ -7,12 +7,21 @@ #include #include #include +#include #include "common/bit_util.h" #include "common/common_types.h" namespace Common { +/** + * A MultiLevelQueue is a type of priority queue which has the following characteristics: + * - iteratable through each of its elements. + * - back can be obtained. + * - O(1) add, lookup (both front and back) + * - discrete priorities and a max of 64 priorities (limited domain) + * This type of priority queue is normaly used for managing threads within an scheduler + */ template class MultiLevelQueue { public: @@ -37,9 +46,7 @@ public: friend bool operator==(const iterator_impl& lhs, const iterator_impl& rhs) { if (lhs.IsEnd() && rhs.IsEnd()) return true; - if (lhs.current_priority == rhs.current_priority) - return lhs.it == rhs.it; - return false; + return std::tie(lhs.current_priority, lhs.it) == std::tie(rhs.current_priority, rhs.it); } friend bool operator!=(const iterator_impl& lhs, const iterator_impl& rhs) { @@ -301,7 +308,6 @@ private: using const_list_iterator = typename std::list::const_iterator; static void ListShiftForward(std::list& list, const std::size_t shift = 1) { - // NOTE: May want to consider making this an assertion or something if (shift >= list.size()) { return; } -- cgit v1.2.3