diff --git a/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/simplify.h b/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/simplify.h index ad9e75cf178..d5497788a02 100644 --- a/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/simplify.h +++ b/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/simplify.h @@ -335,7 +335,7 @@ operator()() } else { (*u)->set_cost(*dist); if(mpq->contains(*u)){ - mpq->update(*u, true); + mpq->update(*u); } else{ mpq->push(*u); @@ -353,7 +353,7 @@ operator()() } else { (*w)->set_cost(*dist); if(mpq->contains(*w)){ - mpq->update(*w, true); + mpq->update(*w); } else{ mpq->push(*w); diff --git a/STL_Extension/include/CGAL/Modifiable_priority_queue.h b/STL_Extension/include/CGAL/Modifiable_priority_queue.h index 4e765306d50..6ee9c4199a6 100644 --- a/STL_Extension/include/CGAL/Modifiable_priority_queue.h +++ b/STL_Extension/include/CGAL/Modifiable_priority_queue.h @@ -78,22 +78,17 @@ public: typedef typename Heap::value_type value_type; typedef typename Heap::size_type size_type; - typedef bool handle ; - public: Modifiable_priority_queue( size_type largest_ID, Compare const& c = Compare(), ID const& id = ID() ) : mHeap(largest_ID,c,id) {} - handle push ( value_type const& v ) { mHeap.push(v) ; return handle(true) ; } - - handle update ( value_type const& v, handle h ) { mHeap.update(v); return h ; } + void push ( value_type const& v ) { mHeap.push(v) ; } void update ( value_type const& v ) { mHeap.update(v); } - handle erase ( value_type const& v, handle ) { mHeap.remove(v); return null_handle() ; } - handle erase ( value_type const& v ) { mHeap.remove(v); return null_handle() ; } + void erase ( value_type const& v ) { mHeap.remove(v); } - value_type top() const { return mHeap.top() ; } + value_type top() const { return mHeap.top(); } void pop() { mHeap.pop(); } @@ -121,8 +116,6 @@ public: return v; } - static handle null_handle() { return handle(false); } - private: Heap mHeap ; diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/internal/Edge_collapse.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/internal/Edge_collapse.h index e327e86be6e..8db94cb744c 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/internal/Edge_collapse.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/internal/Edge_collapse.h @@ -174,27 +174,22 @@ public: }; typedef Modifiable_priority_queue PQ; - typedef typename PQ::handle PQ_handle; // An Edge_data is associated with EVERY _ edge in the mesh (collapsable or not). - // It relates the edge with the PQ-handle needed to update the priority queue + // It contains the edge status wrt the priority queue // It also relates the edge with a policy-based cache - class Edge_data + struct Edge_data { - public : - Edge_data() : m_PQ_h() {} - const Cost_type& cost() const { return m_cost; } Cost_type& cost() { return m_cost; } - PQ_handle queue_handle() const { return m_PQ_h;} - bool is_in_PQ() const { return m_PQ_h != PQ::null_handle(); } - void set_PQ_handle(PQ_handle h) { m_PQ_h = h; } - void reset_queue_handle() { m_PQ_h = PQ::null_handle(); } + bool is_in_PQ() const { return m_is_in_PQ; } + void set_is_in_PQ() { m_is_in_PQ=true; } + void reset_in_queue_status() { m_is_in_PQ = false; } private: Cost_type m_cost; - PQ_handle m_PQ_h; + bool m_is_in_PQ = false; }; typedef Edge_data* Edge_data_ptr; @@ -301,7 +296,8 @@ private: CGAL_expensive_assertion(!data.is_in_PQ()); CGAL_expensive_assertion(!mPQ->contains(h)); - data.set_PQ_handle(mPQ->push(h)); + mPQ->push(h); + data.set_is_in_PQ(); CGAL_expensive_assertion(data.is_in_PQ()); CGAL_expensive_assertion(mPQ->contains(h)); @@ -313,7 +309,8 @@ private: CGAL_expensive_assertion(data.is_in_PQ()); CGAL_expensive_assertion(mPQ->contains(h)); - data.set_PQ_handle(mPQ->update(h, data.queue_handle())); + mPQ->update(h); + data.set_is_in_PQ(); CGAL_assertion(data.is_in_PQ()); CGAL_expensive_assertion(mPQ->contains(h)); @@ -325,7 +322,8 @@ private: CGAL_expensive_assertion(data.is_in_PQ()); CGAL_expensive_assertion(mPQ->contains(h)); - data.set_PQ_handle(mPQ->erase(h, data.queue_handle())); + mPQ->erase(h); + data.reset_in_queue_status(); CGAL_expensive_assertion(!data.is_in_PQ()); CGAL_expensive_assertion(!mPQ->contains(h)); @@ -339,7 +337,7 @@ private: CGAL_assertion(is_primary_edge(*opt_h)); CGAL_expensive_assertion(get_data(*opt_h).is_in_PQ()); - get_data(*opt_h).reset_queue_handle(); + get_data(*opt_h).reset_in_queue_status(); CGAL_expensive_assertion(!get_data(*opt_h).is_in_PQ()); CGAL_expensive_assertion(!mPQ->contains(*opt_h));