Commit 4da17c47 authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Improve soft heap interface.

	* mln/util/soft_heap.hh: rename take() as push().

	* tests/util/soft_heap.cc: update test.

git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@3166 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 1dc16918
2009-01-19 Guillaume Lazzara <z@lrde.epita.fr>
Improve soft heap interface.
* mln/util/soft_heap.hh: rename take() as push().
* tests/util/soft_heap.cc: update test.
2009-01-19 Guillaume Lazzara <z@lrde.epita.fr>
 
Add implementation of Fibonacci heap.
......@@ -197,13 +197,11 @@ namespace mln
/// Add a new element \p element.
void push(const T& element);
/// Insert a site \p p (equivalent as 'push').
void insert(const T& p);
/// Merge \p sh with this heap.
/// Be ware that after this call, \p sh will be empty. This heap will
/// hold the elements which were part of \p sh.
void take(soft_heap<T,R>& sh);
void push(soft_heap<T,R>& sh);
/// Returns the element with the lowest priority and remove it from the
/// heap.
......@@ -227,14 +225,14 @@ namespace mln
/// Reset the heap to an empty heap. Do *NOT* delete element which may
/// have been inserted.
/// \sa take
/// \sa push
void soft_clear_();
private:
/// Merge a node \p q to this heap.
/// \sa take
/// \sa push
void meld(node<T,R> *q);
/// Update suffix_min pointer according to the new values inserted in
......@@ -655,7 +653,7 @@ namespace mln
template <typename T, typename R>
inline
void
soft_heap<T,R>::take(soft_heap<T,R>& psh)
soft_heap<T,R>::push(soft_heap<T,R>& psh)
{
head<T,R> *head = psh.head_hook_();
while (head != 0)
......
......@@ -60,7 +60,7 @@ int main()
fh2.push(p[i]);
// Merge fh in fh2.
fh2.take(fh);
fh2.push(fh);
// fh2 now holds both its elements and fh's.
unsigned i = 0;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment