1 #ifndef theplu_yat_utility_priority_queue 2 #define theplu_yat_utility_priority_queue 21 #include "BasicQueue.h" 23 #include "yat_assert.h" 54 template<
typename T,
class Compare = std::less<T> >
58 , std::multiset<T, Compare> >
61 ,T,
std::multiset<T,Compare> >;
64 , std::multiset<T,Compare> >
Base;
75 :
Base(
std::multiset<T, Compare>(comp)) {}
93 void pop_impl(T& value,
const std::unique_lock<std::mutex>& lock)
100 typename std::multiset<T, Compare>::iterator it = this->
q_.end();
101 YAT_ASSERT(this->
q_.size());
103 value = std::move_if_noexcept(*it);
107 void push_impl(
const T& value, std::unique_lock<std::mutex>& lock)
109 this->
q_.insert(value);
113 void push_impl(T&& value, std::unique_lock<std::mutex>& lock)
115 this->
q_.insert(std::move(value));
PriorityQueue(const PriorityQueue &other)
Copy constructor.
Definition: PriorityQueue.h:80
The Department of Theoretical Physics namespace as we define it.
Some useful functions are placed here.
Definition: stl_utility.h:64
void assign(const BasicQueue &other)
Definition: BasicQueue.h:256
Multi-thread safe priority queue.
Definition: PriorityQueue.h:55
Definition: BasicQueue.h:36
PriorityQueue & operator=(const PriorityQueue &lhs)
assignment operator
Definition: PriorityQueue.h:86
std::multiset< T, Compare > q_
data
Definition: BasicQueue.h:273
PriorityQueue(const Compare &comp)
Create a PriorityQueue with comp as Compare functor.
Definition: PriorityQueue.h:74