00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 # ifndef AH_PRIORITY_QUEUE_H
00044 # define AH_PRIORITY_QUEUE_H
00045
00046 # include <tpl_dynBinHeap.H>
00047
00048 namespace Aleph {
00049
00066 template <typename T, class Compare = Aleph::less<T> >
00067 class priority_queue : private Aleph::DynBinHeap<T, Compare>
00068 {
00069 public:
00070
00072 typedef T value_type;
00073
00075 priority_queue() { }
00076
00078 template <class Container>
00079 priority_queue(Container & cont)
00080 {
00081 const typename Container::iterator end = cont.end();
00082
00083 for (typename Container::iterator it(cont.begin());
00084 it != end; insert(it++));
00085 }
00086
00089 template <class Itor>
00090 priority_queue(Itor beg, const Itor & end)
00091 {
00092 Aleph::verify_iterators (beg, end);
00093
00094 while (beg != end)
00095 insert(beg++);
00096 }
00097
00101 T & push(const T & value) { return insert(value); }
00102
00105 void pop() { this->getMin(); }
00106
00109 const T & top() { return Aleph::DynBinHeap<T, Compare>::top(); }
00110
00112 bool empty() const { return this->is_empty(); }
00113
00115 size_t size() const { return Aleph::DynBinHeap<T, Compare>::size(); }
00116 };
00117
00118 }
00119
00120 # endif // AH_PRIORITY_QUEUE_H