diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map.h b/Combinatorial_map/include/CGAL/Combinatorial_map.h index 4bff6733543..6d320097988 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map.h @@ -477,7 +477,7 @@ namespace CGAL { void set_mark_to(Dart_const_handle adart, int amark, bool astate) const { - // CGAL_assertion( adart != null_dart_handle ); + CGAL_assertion( adart != null_dart_handle ); CGAL_assertion( is_reserved(amark) ); if (is_marked(adart, amark) != astate) @@ -495,7 +495,7 @@ namespace CGAL { */ void mark(Dart_const_handle adart, int amark) const { - // CGAL_assertion( adart != null_dart_handle ); + CGAL_assertion( adart != null_dart_handle ); CGAL_assertion( is_reserved(amark) ); if (is_marked(adart, amark)) return; @@ -510,7 +510,7 @@ namespace CGAL { */ void unmark(Dart_const_handle adart, int amark) const { - // CGAL_assertion( adart != null_dart_handle ); + CGAL_assertion( adart != null_dart_handle ); CGAL_assertion( is_reserved(amark) ); if (!is_marked(adart, amark)) return; @@ -519,6 +519,28 @@ namespace CGAL { adart->set_mark(amark, mmask_marks[(size_type)amark]); } + /** Mark null_dart (used as a sentinel in iterators). + * As null dart does not belong to the set of darts, it is not counted + * as number of marked darts. + * @param amark the given mark. + */ + void mark_null_dart(int amark) const + { + CGAL_assertion( is_reserved(amark) ); + + null_dart_handle->set_mark(amark, !mmask_marks[(size_type)amark]); + } + + /** Unmark null_dart. + * @param amark the given mark. + */ + void unmark_null_dart(int amark) const + { + CGAL_assertion( is_reserved(amark) ); + + null_dart_handle->set_mark(amark, mmask_marks[(size_type)amark]); + } + /** Unmark all the darts of the map for a given mark. * If all the darts are marked or unmarked, this operation takes O(1) * operations, otherwise it traverses all the darts of the map. @@ -536,7 +558,7 @@ namespace CGAL { } else { - unmark(null_dart_handle, amark); + unmark_null_dart(amark); for (typename Dart_range::const_iterator it(darts().begin()), itend(darts().end()); it!=itend; ++it) unmark(it, amark); @@ -1906,6 +1928,7 @@ namespace CGAL { } for (unsigned int i=0; immap->mark(this->mmap->null_dart_handle, mmark_number); + this->mmap->mark_null_dart(mmark_number); this->mmap->mark(minitial_dart, mmark_number); if (!minitial_dart->is_free(Bi) && minitial_dart->beta(Bi)!=minitial_dart ) { @@ -204,7 +204,7 @@ namespace CGAL { Base::operator= ( Base(*this->mmap,minitial_dart) ); mto_treat = std::queue(); this->mmap->mark(minitial_dart, mmark_number); - this->mmap->mark(this->mmap->null_dart_handle, mmark_number); + this->mmap->mark_null_dart(mmark_number); if (!minitial_dart->is_free(Bi) && minitial_dart->beta(Bi)!=minitial_dart ) { mto_treat.push(minitial_dart->beta(Bi));