diff --git a/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h b/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h index f133491b31a..fac4a50bdaf 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h +++ b/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h @@ -33,6 +33,7 @@ #ifndef CGAL_NO_ASSERTIONS # include // for float_prior #endif +#include namespace CGAL { namespace Mesh_3 { @@ -1194,6 +1195,7 @@ change_ball_size(const Vertex_handle& v, const FT size, const bool special_ball) c3t3_.remove_from_complex(v); } + unchecked_vertices_.erase(v); // Change v size c3t3_.triangulation().remove(v); @@ -1235,11 +1237,25 @@ change_ball_size(const Vertex_handle& v, const FT size, const bool special_ball) } // Update unchecked vertices - unchecked_vertices_.erase(v); unchecked_vertices_.insert(new_v); return new_v; } +namespace details { + // Functor used by Protect_edges_sizing_field::check_and_repopulate_edges, below + template + class Erase_element_from_set { + Set* set_ptr; + public: + Erase_element_from_set(Set& set) : set_ptr(&set) {} + + void operator()(const typename Set::key_type& x) + { + set_ptr->erase(x); + } + }; // end class Erase_element_from_set + +} // end namespace details template void @@ -1249,7 +1265,8 @@ check_and_repopulate_edges() #ifdef CGAL_MESH_3_PROTECTION_DEBUG std::cerr << "check_and_repopulate_edges()\n"; #endif - std::set vertices; + typedef std::set Vertices; + Vertices vertices; std::copy( unchecked_vertices_.begin(), unchecked_vertices_.end(), std::inserter(vertices,vertices.begin()) ); @@ -1260,15 +1277,11 @@ check_and_repopulate_edges() { Vertex_handle v = *vertices.begin(); vertices.erase(vertices.begin()); - - Vertex_vector erased_vertices; - check_and_fix_vertex_along_edge(v, std::back_inserter(erased_vertices)); - - for ( typename Vertex_vector::iterator vit = erased_vertices.begin(), - vend = erased_vertices.end() ; vit != vend ; ++vit ) - { - vertices.erase(*vit); - } + + details::Erase_element_from_set erase_from_vertices(vertices); + + check_and_fix_vertex_along_edge(v, + boost::make_function_output_iterator(erase_from_vertices)); } }