summaryrefslogtreecommitdiff
path: root/boost/graph/detail/d_ary_heap.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/graph/detail/d_ary_heap.hpp')
-rw-r--r--boost/graph/detail/d_ary_heap.hpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/boost/graph/detail/d_ary_heap.hpp b/boost/graph/detail/d_ary_heap.hpp
index ba58647a3d..cf930fc187 100644
--- a/boost/graph/detail/d_ary_heap.hpp
+++ b/boost/graph/detail/d_ary_heap.hpp
@@ -20,6 +20,11 @@
#include <boost/shared_array.hpp>
#include <boost/property_map/property_map.hpp>
+// WARNING: it is not safe to copy a d_ary_heap_indirect and then modify one of
+// the copies. The class is required to be copyable so it can be passed around
+// (without move support from C++11), but it deep-copies the heap contents yet
+// shallow-copies the index_in_heap_map.
+
namespace boost {
// Swap two elements in a property map without assuming they model
@@ -121,18 +126,21 @@ namespace boost {
}
Value& top() {
+ BOOST_ASSERT (!this->empty());
return data[0];
}
const Value& top() const {
+ BOOST_ASSERT (!this->empty());
return data[0];
}
void pop() {
+ BOOST_ASSERT (!this->empty());
put(index_in_heap, data[0], (size_type)(-1));
if (data.size() != 1) {
data[0] = data.back();
- put(index_in_heap, data[0], 0);
+ put(index_in_heap, data[0], (size_type)(0));
data.pop_back();
preserve_heap_property_down();
verify_heap();