COIN-OR::LEMON - Graph Library

Changeset 274:28728f3945c5 in lemon-0.x for src/include/bin_heap.h


Ignore:
Timestamp:
04/01/04 23:06:53 (16 years ago)
Author:
Mihaly Barasz
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@386
Message:

bin_heap merge-olva

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/include/bin_heap.h

    r258 r274  
     1// -*- C++ -*- //
     2
    13/* FIXME: Copyright ...
    24 *
     
    6062#define BIN_HEAP_HH
    6163
     64///\file
     65///\brief Binary Heap implementation.
     66
    6267#include <vector>
    6368#include <utility>
     
    6671namespace hugo {
    6772
     73  /// A Binary Heap implementation.
    6874  template <typename Item, typename Prio, typename ItemIntMap,
    6975            typename Compare = std::less<Prio> >
     
    8692     * PRE_HEAP (-1) to any element to be put in the heap...
    8793     */
     94    ///\todo it is used nowhere
     95    ///
    8896    enum state_enum {
    8997      IN_HEAP = 0,
     
    141149
    142150    Item top() const {
    143       // FIXME: test size>0 ?
    144151      return data[0].first;
    145152    }
    146     Prio topPrio() const {
    147       // FIXME: test size>0 ?
     153    /// Returns the prio of the top element of the heap.
     154    Prio prio() const {
    148155      return data[0].second;
    149156    }
     
    157164    }
    158165
    159     Prio get(const Item &i) const {
     166    Prio operator[](const Item &i) const {
    160167      int idx = iim[i];
    161168      return data[idx].second;
    162169    }
    163     Prio operator[](const Item &i) const {
    164       return get(i);
    165     }
     170
    166171    void set(const Item &i, const Prio &p) {
    167172      int idx = iim[i];
Note: See TracChangeset for help on using the changeset viewer.