diff --git a/TDS_3/include/CGAL/Triangulation_data_structure_3.h b/TDS_3/include/CGAL/Triangulation_data_structure_3.h index 7c01149ab44..946c028f9a8 100644 --- a/TDS_3/include/CGAL/Triangulation_data_structure_3.h +++ b/TDS_3/include/CGAL/Triangulation_data_structure_3.h @@ -4039,32 +4039,24 @@ copy_tds(const TDS_src& tds, || tds.is_vertex(vert) ); clear(); - - size_type n = tds.number_of_vertices(); set_dimension(tds.dimension()); - if (n == 0) return Vertex_handle(); + if(tds.number_of_vertices() == 0) + return Vertex_handle(); // Number of pointers to cell/vertex to copy per cell. - int dim = (std::max)(1, dimension() + 1); - - // Create the vertices. - std::vector TV(n); - size_type i = 0; - - for (typename TDS_src::Vertex_iterator vit = tds.vertices_begin(); - vit != tds.vertices_end(); ++vit) - TV[i++] = vit; - - CGAL_triangulation_assertion( i == n ); + const int dim = (std::max)(1, dimension() + 1); + // Initializes maps Unique_hash_map< typename TDS_src::Vertex_handle,Vertex_handle > V; Unique_hash_map< typename TDS_src::Cell_handle,Cell_handle > F; - for (i=0; i <= n-1; ++i){ - Vertex_handle vh=create_vertex( convert_vertex(*TV[i]) ); - V[ TV[i] ] = vh; - convert_vertex(*TV[i],*vh); + // Create the vertices. + for (typename TDS_src::Vertex_iterator vit = tds.vertices_begin(); + vit != tds.vertices_end(); ++vit) { + Vertex_handle vh = create_vertex( convert_vertex(*vit) ); + V[vit] = vh; + convert_vertex(*vit,*vh); } // Create the cells.