diff --git a/Triangulation_3/include/CGAL/Triangulation_3.h b/Triangulation_3/include/CGAL/Triangulation_3.h index 9434f3729be..ae24c418a8d 100644 --- a/Triangulation_3/include/CGAL/Triangulation_3.h +++ b/Triangulation_3/include/CGAL/Triangulation_3.h @@ -4988,35 +4988,22 @@ create_triangulation_inner_map(const Triangulation& t, const Vertex_handle_unique_hash_map& vmap, bool all_cells) { Vertex_triple_Facet_map inner_map; + auto create_triangulation_inner_map_aux = [&](const auto& cells_range) { + for(auto ch : cells_range) { + for(unsigned int index = 0; index < 4; index++) { + Facet f = std::pair(ch, index); + Vertex_triple vt_aux = make_vertex_triple(f); + Vertex_triple vt{vmap[vt_aux[0]], vmap[vt_aux[2]], vmap[vt_aux[1]]}; + make_canonical_oriented_triple(vt); + inner_map[vt] = f; + } + } + }; - if(all_cells) - { - for(All_cells_iterator it = t.all_cells_begin(), - end = t.all_cells_end(); it != end; ++it) - { - for(unsigned int index=0; index < 4; index++) - { - Facet f = std::pair(it,index); - Vertex_triple vt_aux = make_vertex_triple(f); - Vertex_triple vt{vmap[vt_aux[0]], vmap[vt_aux[2]], vmap[vt_aux[1]]}; - make_canonical_oriented_triple(vt); - inner_map[vt] = f; - } - } - } else - { - for(Finite_cells_iterator it = t.finite_cells_begin(), - end = t.finite_cells_end(); it != end; ++it) - { - for(unsigned int index=0; index < 4; index++) - { - Facet f = std::pair(it,index); - Vertex_triple vt_aux = make_vertex_triple(f); - Vertex_triple vt{vmap[vt_aux[0]], vmap[vt_aux[2]], vmap[vt_aux[1]]}; - make_canonical_oriented_triple(vt); - inner_map[vt] = f; - } - } + if(all_cells) { + create_triangulation_inner_map_aux(t.all_cell_handles()); + } else { + create_triangulation_inner_map_aux(t.finite_cell_handles()); } return inner_map; }