diff --git a/Surface_mesh_simplification/include/CGAL/Modifiable_priority_queue.h b/Surface_mesh_simplification/include/CGAL/Modifiable_priority_queue.h index 5bf6fe0fda4..40e29700e80 100644 --- a/Surface_mesh_simplification/include/CGAL/Modifiable_priority_queue.h +++ b/Surface_mesh_simplification/include/CGAL/Modifiable_priority_queue.h @@ -19,7 +19,42 @@ #define CGAL_MODIFIABLE_PRIORITY_QUEUE_H #include // Neeeded by the following Boost header for CHAR_BIT. +#ifdef CGAL_SURFACE_MESH_SIMPLIFICATION_USE_RELAXED_HEAP #include +#else +#include + + +namespace CGAL { + namespace internal { +template , + class Comp = std::less, + class ID = boost::identity_property_map > +class mutable_queue_with_remove : public boost::mutable_queue +{ + typedef boost::mutable_queue Base; +public: + typedef typename Base::size_type size_type; + typedef typename Base::Node Node; + + mutable_queue_with_remove(size_type n, const Comp& x, const ID& _id) : Base(n,x,_id) {} + + void remove(const IndexedType& x){ + //first place element at the top + size_type current_pos = this->index_array[ get(this->id, x) ]; + this->c[current_pos] = x; + + Node node(this->c.begin(), this->c.end(), this->c.begin()+current_pos, this->id); + while (node.has_parent()) + node.swap(node.parent(), this->index_array); + //then pop it + this->pop(); + } +}; + +} } //namespace CGAL::internal +#endif //CGAL_SURFACE_MESH_SIMPLIFICATION_USE_RELAXED_HEAP namespace CGAL { @@ -37,8 +72,11 @@ public: typedef Compare_ Compare; typedef ID_ ID ; - typedef boost::relaxed_heap Heap ; - + #ifdef CGAL_SURFACE_MESH_SIMPLIFICATION_USE_RELAXED_HEAP + typedef boost::relaxed_heap Heap; + #else + typedef internal::mutable_queue_with_remove,Compare,ID> Heap; + #endif //CGAL_SURFACE_MESH_SIMPLIFICATION_USE_RELAXED_HEAP typedef typename Heap::value_type value_type; typedef typename Heap::size_type size_type;