summaryrefslogtreecommitdiff
path: root/boost/heap/fibonacci_heap.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/heap/fibonacci_heap.hpp')
-rw-r--r--boost/heap/fibonacci_heap.hpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/boost/heap/fibonacci_heap.hpp b/boost/heap/fibonacci_heap.hpp
index 907d442307..76d1cfae65 100644
--- a/boost/heap/fibonacci_heap.hpp
+++ b/boost/heap/fibonacci_heap.hpp
@@ -68,6 +68,11 @@ struct make_fibonacci_heap_base
allocator_type(std::move(static_cast<allocator_type&>(rhs)))
{}
+ type(type & rhs):
+ base_type(static_cast<base_type&>(rhs)),
+ allocator_type(static_cast<allocator_type&>(rhs))
+ {}
+
type & operator=(type && rhs)
{
base_type::operator=(std::move(static_cast<base_type&>(rhs)));
@@ -232,6 +237,13 @@ public:
rhs.top_element = NULL;
}
+ fibonacci_heap(fibonacci_heap & rhs):
+ super_t(rhs), top_element(rhs.top_element)
+ {
+ roots.splice(roots.begin(), rhs.roots);
+ rhs.top_element = NULL;
+ }
+
/// \copydoc boost::heap::priority_queue::operator=(priority_queue &&)
fibonacci_heap & operator=(fibonacci_heap && rhs)
{
@@ -605,7 +617,8 @@ public:
/// \copydoc boost::heap::d_ary_heap_mutable::s_handle_from_iterator
static handle_type s_handle_from_iterator(iterator const & it)
{
- return super_t::s_handle_from_iterator(&*it);
+ node * ptr = const_cast<node *>(it.get_node());
+ return handle_type(ptr);
}
/// \copydoc boost::heap::priority_queue::value_comp
@@ -701,6 +714,9 @@ private:
void consolidate(void)
{
+ if (roots.empty())
+ return;
+
static const size_type max_log2 = sizeof(size_type) * 8;
boost::array<node_pointer, max_log2> aux;
aux.assign(NULL);