From 27ba7b6ba5e599d6bf6f756d3ef044f4f0aa5051 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 17 Mar 2022 23:52:05 +0100 Subject: [PATCH] Various fixes for Modifiable_priority_queues (mostly pairing_heap) --- .../include/CGAL/Modifiable_priority_queue.h | 101 +++++++++++++----- 1 file changed, 72 insertions(+), 29 deletions(-) diff --git a/STL_Extension/include/CGAL/Modifiable_priority_queue.h b/STL_Extension/include/CGAL/Modifiable_priority_queue.h index 270fe8250e2..2e62ff5dca6 100644 --- a/STL_Extension/include/CGAL/Modifiable_priority_queue.h +++ b/STL_Extension/include/CGAL/Modifiable_priority_queue.h @@ -19,6 +19,7 @@ #include +#include #include namespace CGAL { @@ -57,7 +58,7 @@ public: void erase ( value_type const& v ) { mHeap.remove(v); } - value_type top() const { return mHeap.top(); } + const value_type& top() const { return mHeap.top(); } void pop() { mHeap.pop(); } @@ -98,11 +99,12 @@ struct Modifiable_priority_queue extract_top() { - boost::optional r ; - if ( !empty() ) + boost::optional r; + if(!empty()) { value_type v = top(); pop(); - r = boost::optional(v) ; + r = boost::optional(v); } - return r ; + + return r; } value_type top_and_pop() @@ -195,15 +241,12 @@ public: reserve_impl(r, std::integral_constant()); } - private: - - Heap mHeap ; + Heap mHeap; ID mID; - std::vector mHandles; -} ; + std::vector mHandles; +}; -} //namespace CGAL - -#endif +} // namespace CGAL +#endif // CGAL_MODIFIABLE_PRIORITY_QUEUE_H