1 #ifndef TPZPRIORITYQUEUE_H 2 #define TPZPRIORITYQUEUE_H 9 template <
class T,
class Container = std::vector<T>,
class Compare = std::less<
typename Container::value_type>>
31 this->
c.push_back(item);
32 std::sort(this->
c.begin(), this->
c.end(), this->
comp);
36 T highestItem = this->
top();
41 bool remove(T& value) {
42 auto it = std::find(this->
c.begin(), this->
c.end(), value);
43 if (it != this->
c.end()) {
45 std::sort(this->
c.begin(), this->
c.end(), this->
comp);
52 void remove(
const typename Container::size_type begin,
const typename Container::size_type end) {
53 this->
c.erase(this->
c.begin() + begin, this->
c.begin() + end);
57 return c.operator[](0);
60 typename Container::size_type
size()
const {
64 const T &
getItem(
const typename Container::size_type index)
const {
65 return this->
c.operator[](index);
72 void pop_back(
const typename Container::size_type count) {
73 c.erase(
c.end()-count,
c.end());
93 #endif // TPZPRIORITYQUEUE_H void addItem(const T &item)
pthread_mutex_t mutex
Semaphore which controls multiple threads.
Container::size_type size() const
const T & getItem(const typename Container::size_type index) const
TPZPriorityQueue & operator=(const TPZPriorityQueue &other)
TPZPriorityQueue(const TPZPriorityQueue &other)
void pop_back(const typename Container::size_type count)