1 #ifndef theplu_yat_utility_priority_queue 2 #define theplu_yat_utility_priority_queue 22 #include "BasicQueue.h" 24 #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;
69 PriorityQueue(void) {}
75 :
Base(std::multiset<T, Compare>(comp)) {}
93 void pop_impl(T& value,
const boost::unique_lock<boost::mutex>& lock)
100 typename std::multiset<T, Compare>::iterator it = this->
q_.end();
101 YAT_ASSERT(this->
q_.size());
107 void push_impl(
const T& value, boost::unique_lock<boost::mutex>& lock)
109 this->
q_.insert(value);
113 #ifdef YAT_HAVE_RVALUE 114 void push_impl(T&& value, boost::unique_lock<boost::mutex>& lock)
116 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.
void assign(const BasicQueue &other)
Definition: BasicQueue.h:168
Multi-thread safe priority queue.
Definition: PriorityQueue.h:55
Definition: BasicQueue.h:34
#define YAT_MOVE_IF_NOEXCEPT(arg)
if rvalue not available, do nothing
Definition: utility.h:352
PriorityQueue & operator=(const PriorityQueue &lhs)
assignment operator
Definition: PriorityQueue.h:86
std::multiset< T, Compare > q_
data
Definition: BasicQueue.h:184
PriorityQueue(const Compare &comp)
Create a PriorityQueue with comp as Compare functor.
Definition: PriorityQueue.h:74