Changeset 274:28728f3945c5 in lemon-0.x for src/include
- Timestamp:
- 04/01/04 23:06:53 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@386
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/include/bin_heap.h
r258 r274 1 // -*- C++ -*- // 2 1 3 /* FIXME: Copyright ... 2 4 * … … 60 62 #define BIN_HEAP_HH 61 63 64 ///\file 65 ///\brief Binary Heap implementation. 66 62 67 #include <vector> 63 68 #include <utility> … … 66 71 namespace hugo { 67 72 73 /// A Binary Heap implementation. 68 74 template <typename Item, typename Prio, typename ItemIntMap, 69 75 typename Compare = std::less<Prio> > … … 86 92 * PRE_HEAP (-1) to any element to be put in the heap... 87 93 */ 94 ///\todo it is used nowhere 95 /// 88 96 enum state_enum { 89 97 IN_HEAP = 0, … … 141 149 142 150 Item top() const { 143 // FIXME: test size>0 ?144 151 return data[0].first; 145 152 } 146 Prio topPrio() const {147 // FIXME: test size>0 ?153 /// Returns the prio of the top element of the heap. 154 Prio prio() const { 148 155 return data[0].second; 149 156 } … … 157 164 } 158 165 159 Prio get(const Item &i) const {166 Prio operator[](const Item &i) const { 160 167 int idx = iim[i]; 161 168 return data[idx].second; 162 169 } 163 Prio operator[](const Item &i) const { 164 return get(i); 165 } 170 166 171 void set(const Item &i, const Prio &p) { 167 172 int idx = iim[i];
Note: See TracChangeset
for help on using the changeset viewer.