lemon/concepts/heap.h
changeset 2547 f393a8162688
parent 2391 14a343be7a5a
child 2553 bfced05fa852
equal deleted inserted replaced
2:6ae74c5081d4 3:c22225a00a09
    50       /// "pre heap" or "post heap". The later two are indifferent from the
    50       /// "pre heap" or "post heap". The later two are indifferent from the
    51       /// heap's point of view, but may be useful to the user.
    51       /// heap's point of view, but may be useful to the user.
    52       ///
    52       ///
    53       /// The ItemIntMap _should_ be initialized in such way, that it maps
    53       /// The ItemIntMap _should_ be initialized in such way, that it maps
    54       /// PRE_HEAP (-1) to any element to be put in the heap...
    54       /// PRE_HEAP (-1) to any element to be put in the heap...
    55       enum state_enum {
    55       enum State {
    56 	IN_HEAP = 0,
    56 	IN_HEAP = 0,
    57 	PRE_HEAP = -1,
    57 	PRE_HEAP = -1,
    58 	POST_HEAP = -2
    58 	POST_HEAP = -2
    59       };
    59       };
    60       
    60       
   153       /// This method returns PRE_HEAP if \c item has never been in the
   153       /// This method returns PRE_HEAP if \c item has never been in the
   154       /// heap, IN_HEAP if it is in the heap at the moment, and POST_HEAP
   154       /// heap, IN_HEAP if it is in the heap at the moment, and POST_HEAP
   155       /// otherwise. In the latter case it is possible that \c item will
   155       /// otherwise. In the latter case it is possible that \c item will
   156       /// get back to the heap again.
   156       /// get back to the heap again.
   157       /// \param i The item.
   157       /// \param i The item.
   158       state_enum state(const Item &i) const {}
   158       State state(const Item &i) const {}
   159 
   159 
   160       /// \brief Sets the state of the \c item in the heap.
   160       /// \brief Sets the state of the \c item in the heap.
   161       ///
   161       ///
   162       /// Sets the state of the \c item in the heap. It can be used to
   162       /// Sets the state of the \c item in the heap. It can be used to
   163       /// manually clear the heap when it is important to achive the
   163       /// manually clear the heap when it is important to achive the
   164       /// better time complexity.
   164       /// better time complexity.
   165       /// \param i The item.
   165       /// \param i The item.
   166       /// \param st The state. It should not be \c IN_HEAP. 
   166       /// \param st The state. It should not be \c IN_HEAP. 
   167       void state(const Item& i, state_enum st) {}
   167       void state(const Item& i, State st) {}
   168 
   168 
   169 
   169 
   170       template <typename _Heap>
   170       template <typename _Heap>
   171       struct Constraints {
   171       struct Constraints {
   172       public:
   172       public:
   179 	  prio=Prio();
   179 	  prio=Prio();
   180 
   180 
   181 	  ignore_unused_variable_warning(item);
   181 	  ignore_unused_variable_warning(item);
   182 	  ignore_unused_variable_warning(prio);
   182 	  ignore_unused_variable_warning(prio);
   183 
   183 
   184 	  typedef typename _Heap::state_enum state_enum;
   184 	  typedef typename _Heap::State State;
   185 	  state_enum state;
   185 	  State state;
   186 
   186 
   187 	  ignore_unused_variable_warning(state);
   187 	  ignore_unused_variable_warning(state);
   188       
   188       
   189 	  _Heap heap1 = _Heap(map);
   189 	  _Heap heap1 = _Heap(map);
   190 
   190