Add assertions and fix bug

This commit is contained in:
Simon Giraudot 2020-10-21 10:12:51 +02:00
parent 7d23ac99e2
commit adef28b496
1 changed files with 9 additions and 1 deletions

View File

@ -84,16 +84,18 @@ public:
void before_init() const
{
std::size_t idx = 0;
backup_inc.reserve (nb_vertices());
backup_inc.resize (nb_vertices());
for (typename Arr1::Vertex_const_iterator vit = arr1.vertices_begin();
vit != arr1.vertices_end(); ++vit, ++idx)
{
CGAL_assertion (idx < backup_inc.size());
backup_inc[idx] = vit->inc();
vit->set_inc (reinterpret_cast<void*>(idx));
}
for (typename Arr2::Vertex_const_iterator vit = arr2.vertices_begin();
vit != arr2.vertices_end(); ++vit, ++idx)
{
CGAL_assertion (idx < backup_inc.size());
backup_inc[idx] = vit->inc();
vit->set_inc (reinterpret_cast<void*>(idx));
}
@ -105,10 +107,16 @@ public:
std::size_t idx = 0;
for (typename Arr1::Vertex_const_iterator vit = arr1.vertices_begin();
vit != arr1.vertices_end(); ++vit, ++idx)
{
CGAL_assertion (idx < backup_inc.size());
vit->set_inc (backup_inc[idx]);
}
for (typename Arr2::Vertex_const_iterator vit = arr2.vertices_begin();
vit != arr2.vertices_end(); ++vit, ++idx)
{
CGAL_assertion (idx < backup_inc.size());
vit->set_inc (backup_inc[idx]);
}
}
private: