diff --git a/Combinatorial_map/include/CGAL/Compact_container_with_index.h b/Combinatorial_map/include/CGAL/Compact_container_with_index.h index f8baef67da8..4051d61e193 100644 --- a/Combinatorial_map/include/CGAL/Compact_container_with_index.h +++ b/Combinatorial_map/include/CGAL/Compact_container_with_index.h @@ -240,16 +240,13 @@ public: void increase_to(size_type old_size) { CGAL_assertion(m_cc_with_index->capacity()>old_size); - CGAL_assertion(m_free_list==null_descriptor); // Previous container was full m_used.resize(m_cc_with_index->capacity(), false); - size_type i=0; - if(old_size>0) - { i=old_size-1; } - for(; i(m_cc_with_index->capacity()-1); ++i) + for(size_type i=old_size; + i(m_cc_with_index->capacity()-1); ++i) { Traits::set_size_t((*m_cc_with_index)[i], i+1); } // Next of the last element is null_descriptor. Traits::set_size_t((*m_cc_with_index)[m_cc_with_index->capacity()-1], - null_descriptor); + m_free_list); m_free_list=old_size; } @@ -571,6 +568,7 @@ public: std::swap(size_, c.size_); std::swap(block_size, c.block_size); std::swap(all_items, c.all_items); + //all_items.swap(c.all_items); free_list.swap(c.free_list); } @@ -828,7 +826,6 @@ clear() { for (size_type i=0; i::deallocate(alloc, all_items, capacity_); all_items=nullptr; @@ -848,9 +845,9 @@ increase_size() { if(is_used(index)) { - /*std::allocator_traits::construct - (alloc, &(all_items2[index]), std::move(all_items[index]));*/ - new (&all_items2[index]) value_type(all_items[index]); + std::allocator_traits::construct + (alloc, &(all_items2[index]), std::move(all_items[index])); + //new (&all_items2[index]) value_type(all_items[index]); // TEMPO TO DEBUG CGAL_assertion(all_items[index]==all_items2[index]); alloc.destroy(&(all_items[index])); diff --git a/Combinatorial_map/include/CGAL/Dart.h b/Combinatorial_map/include/CGAL/Dart.h index 25900743e62..62c86b80f31 100644 --- a/Combinatorial_map/include/CGAL/Dart.h +++ b/Combinatorial_map/include/CGAL/Dart.h @@ -145,6 +145,16 @@ namespace CGAL { return mf[i]; } + bool operator==(const Self& other) const + { + if(mmarks!=other.mmarks || + mattribute_descriptors!=other.mattribute_descriptors) + { return false; } + for(unsigned int i=0; i<=dimension; ++i) + { if(mf[i]!=other.mf[i]) { return false; }} + return true; + } + protected: /** Default constructor: no real initialisation, * because this is done in the combinatorial map class. @@ -172,16 +182,6 @@ namespace CGAL { return *this; } - friend bool operator==(const Self& d1, const Self& d2) - { - if(d1.mmarks!=d2.mmarks || - d1.mattribute_descriptors!=d2.mattribute_descriptors) - { return false; } - for(unsigned int i=0; i<=dimension; ++i) - { if(d1.mf[i]!=d2.mf[i]) { return false; }} - return true; - } - /** Return the mark value of a given mark number. * @param amark the mark number. * @return the value for this number. @@ -296,6 +296,9 @@ namespace CGAL { typedef Dart Self; typedef Info_ Info; + bool operator==(const Self& other) const + { return Base::operator==(other) && minfo==other.minfo; } + protected: /** Default constructor: no real initialisation, * because this is done in the combinatorial or generalized map class. @@ -306,14 +309,12 @@ namespace CGAL { Dart(const Info_& info) : minfo(info) {} + protected: Info_& info() { return minfo; } const Info_& info() const { return minfo; } - friend bool operator==(const Self& d1, const Self& d2) - { return Base(d1)==Base(d2) && d1.minfo==d2.minfo; } - protected: Info minfo; }; diff --git a/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_copy_test.cpp b/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_copy_test.cpp index 4b460e256c9..d0e7eda9e99 100644 --- a/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_copy_test.cpp +++ b/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_copy_test.cpp @@ -498,10 +498,12 @@ template void create2Dmap(Map& map) { for ( int i=0; i<15; ++i ) + { map.make_tetrahedron(typename Map::Point(i, 0, 0), typename Map::Point(i, 2, 0), typename Map::Point(i+1, 0, 0), typename Map::Point(i+1, 1, 2)); + } InitDartInfo::run(map); CreateAttributes::run(map); CreateAttributes::run(map);