fix iterators types in c3t3

This commit is contained in:
Laurent Rineau 2024-05-21 18:01:11 +02:00
parent 797c056577
commit 1289cadc7a
2 changed files with 13 additions and 8 deletions

View File

@ -444,8 +444,8 @@ public:
*/
void remove_from_complex(const Vertex_handle& v)
{
corners_.erase(v);
v->set_dimension(-1);
corners_.erase(v);
}
/** sets the index of vertex \p vertex to \p index
@ -983,7 +983,7 @@ private:
pointer operator->() const { return *(this->base()); }
reference operator*() const { return **(this->base()); }
operator Vertex_handle() const { return Vertex_handle(*(this->base())); }
operator const Vertex_handle&() const { return *(this->base()); }
};
public:
@ -1048,13 +1048,13 @@ public:
Self operator++(int) { Self tmp(*this); ++(*this); return tmp; }
Self operator--(int) { Self tmp(*this); --(*this); return tmp; }
operator Cell_handle() const { return Cell_handle(this->base()); }
operator const Cell_handle&() const { return this->base(); }
}; // end class Cells_in_complex_iterator
typedef Iterator_range<Prevent_deref<Vertices_in_complex_iterator, Vertex_handle> > Vertices_in_complex;
typedef Iterator_range<Edges_in_complex_iterator> Edges_in_complex;
typedef Iterator_range<Facets_in_complex_iterator> Facets_in_complex;
typedef Iterator_range<Prevent_deref<Cells_in_complex_iterator, Cell_handle> > Cells_in_complex;
typedef Iterator_range<Prevent_deref<Vertices_in_complex_iterator, const Vertex_handle&>> Vertices_in_complex;
typedef Iterator_range<Edges_in_complex_iterator> Edges_in_complex;
typedef Iterator_range<Facets_in_complex_iterator> Facets_in_complex;
typedef Iterator_range<Prevent_deref<Cells_in_complex_iterator, const Cell_handle&>> Cells_in_complex;
#endif

View File

@ -347,8 +347,13 @@ struct Tester
//-------------------------------------------------------
std::cout << "Test vertex iterators\n";
const Vertex_handle& vertex_to_modify = c3t3.vertices_in_complex_begin();
Vertex_handle vertex_to_modify_copy = vertex_to_modify;
c3t3.remove_from_complex(vertex_to_modify);
c3t3.add_to_complex(vertex_to_modify,corner_index_bis);
// now `vertex_to_modify` is a dangling ref to a `Vertex_handle`
// use a copy of it: `vertex_to_modify_copy`
c3t3.add_to_complex(vertex_to_modify_copy,corner_index_bis);
typename C3t3::Vertices_in_complex_iterator corner_vit =
c3t3.vertices_in_complex_begin(corner_index);