19 #ifndef CGAL_MODIFIABLE_PRIORITY_QUEUE_H
20 #define CGAL_MODIFIABLE_PRIORITY_QUEUE_H
22 #define CGAL_SURFACE_MESH_SIMPLIFICATION_USE_RELAXED_HEAP
25 #include <boost/optional.hpp>
26 #include <boost/pending/relaxed_heap.hpp>
30 template <
class IndexedType_
31 ,
class Compare_ = std::less<IndexedType_>
32 ,
class ID_ = boost::identity_property_map
34 class Modifiable_priority_queue
38 typedef Modifiable_priority_queue Self;
40 typedef IndexedType_ IndexedType ;
41 typedef Compare_ Compare;
44 typedef boost::relaxed_heap<IndexedType,Compare,ID> Heap;
45 typedef typename Heap::value_type value_type;
46 typedef typename Heap::size_type size_type;
52 Modifiable_priority_queue( size_type largest_ID, Compare
const& c, ID
const&
id ) : mHeap(largest_ID,c,id) {}
54 handle push ( value_type
const& v ) { mHeap.push(v) ;
return handle(
true) ; }
56 handle update ( value_type
const& v, handle h ) { mHeap.update(v);
return h ; }
58 handle erase ( value_type
const& v, handle ) { mHeap.remove(v);
return null_handle() ; }
60 value_type top()
const {
return mHeap.top() ; }
62 void pop() { mHeap.pop(); }
64 bool empty()
const {
return mHeap.empty() ; }
66 bool contains ( value_type
const& v ) {
return mHeap.contains(v) ; }
68 boost::optional<value_type> extract_top()
70 boost::optional<value_type> r ;
75 r = boost::optional<value_type>(v) ;
80 static handle null_handle() {
return handle(
false); }