diff --git a/Triangulation_2/include/CGAL/Triangulation_2/internal/Polyline_constraint_hierarchy_2.h b/Triangulation_2/include/CGAL/Triangulation_2/internal/Polyline_constraint_hierarchy_2.h index 7c26bc7cb795..b7afe8a7fc4c 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2/internal/Polyline_constraint_hierarchy_2.h +++ b/Triangulation_2/include/CGAL/Triangulation_2/internal/Polyline_constraint_hierarchy_2.h @@ -21,6 +21,15 @@ #include #include #include + +#include +#if BOOST_VERSION >= 108100 +# include +# define CGAL_USE_BOOST_UNORDERED 1 +#else // BOOST before 1.81.0 +# include +#endif + #include #include @@ -134,24 +143,6 @@ class Polyline_constraint_hierarchy_2 } }; - class Pair_compare { - Compare comp; - - public: - Pair_compare(const Compare& comp) : comp(comp) {} - - bool operator()(const Edge& e1, const Edge& e2) const { - if(comp(e1.first, e2.first)) { - return true; - } else if((! comp(e2.first, e1.first)) && // !less(e1,e2) && !less(e2,e1) == equal - comp(e1.second, e2.second)) { - return true; - } else { - return false; - } - } - }; - class Context { friend class Polyline_constraint_hierarchy_2; private: @@ -171,8 +162,11 @@ class Polyline_constraint_hierarchy_2 typedef typename Context_list::iterator Context_iterator; typedef std::set Constraint_set; - typedef std::map Sc_to_c_map; +#if CGAL_USE_BOOST_UNORDERED + typedef boost::unordered_flat_map> Sc_to_c_map; +#else + typedef std::unordered_map> Sc_to_c_map; +#endif typedef typename Constraint_set::iterator C_iterator; typedef typename Sc_to_c_map::const_iterator Sc_iterator; typedef Sc_iterator Subconstraint_iterator; @@ -186,7 +180,7 @@ class Polyline_constraint_hierarchy_2 public: Polyline_constraint_hierarchy_2(const Compare& comp) : comp(comp) - , sc_to_c_map(Pair_compare(comp)) + , sc_to_c_map() { } Polyline_constraint_hierarchy_2(const Polyline_constraint_hierarchy_2& ch); Polyline_constraint_hierarchy_2(Polyline_constraint_hierarchy_2&&) = default; @@ -290,7 +284,7 @@ template Polyline_constraint_hierarchy_2:: Polyline_constraint_hierarchy_2(const Polyline_constraint_hierarchy_2& ch) : comp(ch.comp) - , sc_to_c_map(Pair_compare(comp)) + , sc_to_c_map() { copy(ch); }