31 #ifndef CRAB_PRIORITYQUEUE_H 32 #define CRAB_PRIORITYQUEUE_H 41 template<
typename Node>
44 bool (*compare)(
Node const *,
Node const *);
87 void remove(
Node const *node);
100 template<
typename Node>
104 template<
typename Node>
106 return _open.
empty();
109 template<
typename Node>
114 template<
typename Node>
119 template<
typename Node>
124 template<
typename Node>
129 template<
typename Node>
134 template<
typename Node>
136 _open.erase(
Common::remove(_open.begin(), _open.end(), node), _open.end());
139 template<
typename Node>
141 sorted.
resize(_open.size());
147 #endif // CRAB_PRIORITYQUEUE_H void enumerate(Common::Array< Node const *> &sorted) const
Enumerates all nodes in the heap so far.
Definition: PriorityQueue.h:140
PriorityQueue(bool(*)(Node const *, Node const *))
Constructs a new PriorityQueue that heap-sorts nodes using the specified comparator.
Definition: PriorityQueue.h:101
iterator begin()
Definition: array.h:374
The open heap used by all cost-based search algorithms.
Definition: PriorityQueue.h:42
void pop()
Removes the least costly node from the heap.
Definition: PriorityQueue.h:130
Out copy(In first, In last, Out dst)
Definition: algorithm.h:52
bool empty() const
Returns true if the heap contains no nodes, false otherwise.
Definition: PriorityQueue.h:105
RandomIt upperBound(RandomIt first, RandomIt last, const V &val, Comp comp={})
Definition: algorithm.h:513
void push(Node *node)
Pushes the specified node onto the heap.
Definition: PriorityQueue.h:120
Definition: moveeffect.h:37
void clear()
Removes all nodes from the heap.
Definition: PriorityQueue.h:110
It remove(It first, It last, const T &val)
Definition: algorithm.h:466
void resize(size_type newSize)
Definition: array.h:411
Definition: lobject.h:332
size_t size() const
Returns the number of nodes currently in the heap.
Definition: PriorityQueue.h:115
Node * front() const
Returns the least costly node in the heap.
Definition: PriorityQueue.h:125