diff --git a/Combinatorial_map/include/CGAL/Cell_attribute.h b/Combinatorial_map/include/CGAL/Cell_attribute.h index ce35d7ce44c..153c4f643a1 100644 --- a/Combinatorial_map/include/CGAL/Cell_attribute.h +++ b/Combinatorial_map/include/CGAL/Cell_attribute.h @@ -131,20 +131,20 @@ namespace CGAL { /// Increment the reference counting. void inc_nb_refs() - { ++mrefcounting; } + { mrefcounting+=4; } // 4 because this is the 3rd bit (ie 1<<2) /// Decrement the reference counting. void dec_nb_refs() { - CGAL_assertion( mrefcounting>0 ); - --mrefcounting; + CGAL_assertion( mrefcounting>3 ); + mrefcounting-=4; // 4 because this is the 3rd bit (ie 1<<2) } + public: /// Get the reference counting. unsigned int get_nb_refs() const - { return mrefcounting; } + { return (mrefcounting>>2); } // >>2 to ignore the 2 least significant bits - public: void * for_compact_container() const { return vp; } void * & for_compact_container() diff --git a/Combinatorial_map/include/CGAL/Cell_iterators.h b/Combinatorial_map/include/CGAL/Cell_iterators.h index a9a38c1e98c..fea03a3418d 100644 --- a/Combinatorial_map/include/CGAL/Cell_iterators.h +++ b/Combinatorial_map/include/CGAL/Cell_iterators.h @@ -112,7 +112,10 @@ namespace CGAL { CMap_cell_iterator(const Self& aiterator): Ite(aiterator), mcell_mark_number(aiterator.mcell_mark_number) - { this->mmap->share_a_mark(this->mcell_mark_number); } + { + this->mmap->share_a_mark(this->mmark_number); + this->mmap->share_a_mark(this->mcell_mark_number); + } /// Assignment operator. Self& operator=(const Self& aiterator) @@ -120,6 +123,7 @@ namespace CGAL { if (this != &aiterator) { Ite::operator=(aiterator); + this->mmap->share_a_mark(this->mmark_number); this->mmap->share_a_mark(mcell_mark_number); } return *this; diff --git a/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_test.cpp b/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_test.cpp index 1d374f684c6..c358a86a963 100644 --- a/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_test.cpp +++ b/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_test.cpp @@ -32,6 +32,19 @@ struct Myitems_2 }; }; +struct Myitems_2c +{ + template + struct Dart_wrapper + { + typedef CGAL::Dart<2, LCC> Dart; + + typedef CGAL::Cell_attribute_with_point myattrib; + typedef CGAL::cpp11::tuple + Attributes; + }; +}; struct Myitems_3 { template @@ -46,6 +59,20 @@ struct Myitems_3 }; }; +struct Myitems_3c +{ + template + struct Dart_wrapper + { + typedef CGAL::Dart<3, LCC> Dart; + + typedef CGAL::Cell_attribute_with_point myattrib; + typedef CGAL::cpp11::tuple + Attributes; + }; +}; + struct Myitems_4 { template @@ -60,6 +87,19 @@ struct Myitems_4 }; }; +struct Myitems_4c +{ + template + struct Dart_wrapper + { + typedef CGAL::Dart<4, LCC> Dart; + + typedef CGAL::Cell_attribute_with_point myattrib; + typedef CGAL::cpp11::tuple + Attributes; + }; +}; int main() { @@ -95,6 +135,14 @@ int main() return EXIT_FAILURE; } + typedef CGAL::Linear_cell_complex<2,2, + CGAL::Linear_cell_complex_traits<2>, + Myitems_2c> LCC2c; + if ( !test_LCC_2() ) + { + std::cout<<" Error during Test_LCC_2."<, Myitems_3> LCC3b; @@ -103,6 +151,15 @@ int main() std::cout<<" Error during Test_LCC_3."<, + Myitems_3c> LCC3c; + if ( !test_LCC_3() ) + { + std::cout<<" Error during Test_LCC_3."<, @@ -113,6 +170,15 @@ int main() return EXIT_FAILURE; } + typedef CGAL::Linear_cell_complex<4,4, + CGAL::Linear_cell_complex_traits<4>, + Myitems_4c> LCC4c; + if ( !test_LCC_4() ) + { + std::cout<<" Error during Test_LCC_4."<