From 6db28ed43d48964743e8a7dd695e16d9d2f8b3fa Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 14 Feb 2014 17:15:33 +0100 Subject: [PATCH] move ts from Tds to Compact_container Tds now is back to its original version (not different from master) --- .../include/CGAL/Compact_container.h | 25 +++++++++++++------ .../CGAL/Triangulation_data_structure_3.h | 17 ------------- 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/STL_Extension/include/CGAL/Compact_container.h b/STL_Extension/include/CGAL/Compact_container.h index 55618a0ba09..cfbbf6bcbf4 100644 --- a/STL_Extension/include/CGAL/Compact_container.h +++ b/STL_Extension/include/CGAL/Compact_container.h @@ -157,6 +157,7 @@ public: { init(); block_size = c.block_size; + time_stamp = c.time_stamp; std::copy(c.begin(), c.end(), CGAL::inserter(*this)); } @@ -184,6 +185,7 @@ public: std::swap(last_item, c.last_item); std::swap(free_list, c.free_list); all_items.swap(c.all_items); + std::swap(time_stamp, c.time_stamp); } iterator begin() { return iterator(first_item, 0, 0); } @@ -229,6 +231,7 @@ public: new (ret) value_type(args...); CGAL_assertion(type(ret) == USED); ++size_; + ret->ts = time_stamp++; return iterator(ret, 0); } #else @@ -243,6 +246,7 @@ public: new (ret) value_type(); CGAL_assertion(type(ret) == USED); ++size_; + ret->ts = time_stamp++; return iterator(ret, 0); } @@ -258,6 +262,7 @@ public: new (ret) value_type(t1); CGAL_assertion(type(ret) == USED); ++size_; + ret->ts = time_stamp++; return iterator(ret, 0); } @@ -273,6 +278,7 @@ public: new (ret) value_type(t1, t2); CGAL_assertion(type(ret) == USED); ++size_; + ret->ts = time_stamp++; return iterator(ret, 0); } @@ -288,6 +294,7 @@ public: new (ret) value_type(t1, t2, t3); CGAL_assertion(type(ret) == USED); ++size_; + ret->ts = time_stamp++; return iterator(ret, 0); } @@ -303,6 +310,7 @@ public: new (ret) value_type(t1, t2, t3, t4); CGAL_assertion(type(ret) == USED); ++size_; + ret->ts = time_stamp++; return iterator(ret, 0); } @@ -319,6 +327,7 @@ public: new (ret) value_type(t1, t2, t3, t4, t5); CGAL_assertion(type(ret) == USED); ++size_; + ret->ts = time_stamp++; return iterator(ret, 0); } @@ -336,6 +345,7 @@ public: new (ret) value_type(t1, t2, t3, t4, t5, t6); CGAL_assertion(type(ret) == USED); ++size_; + ret->ts = time_stamp++; return iterator(ret, 0); } @@ -353,6 +363,7 @@ public: new (ret) value_type(t1, t2, t3, t4, t5, t6, t7); CGAL_assertion(type(ret) == USED); ++size_; + ret->ts = time_stamp++; return iterator(ret, 0); } @@ -370,6 +381,7 @@ public: new (ret) value_type(t1, t2, t3, t4, t5, t6, t7, t8); CGAL_assertion(type(ret) == USED); ++size_; + ret->ts = time_stamp++; return iterator(ret, 0); } #endif // CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES @@ -384,6 +396,7 @@ public: alloc.construct(ret, t); CGAL_assertion(type(ret) == USED); ++size_; + ret->ts = time_stamp++; return iterator(ret, 0); } @@ -574,6 +587,7 @@ private: first_item = NULL; last_item = NULL; all_items = All_items(); + time_stamp = 0; } allocator_type alloc; @@ -584,6 +598,7 @@ private: pointer first_item; pointer last_item; All_items all_items; + std::size_t time_stamp; }; template < class T, class Allocator > @@ -865,25 +880,21 @@ namespace internal { bool operator<(const CC_iterator& other) const { return m_ptr.p->ts < other.m_ptr.p->ts; - return (m_ptr.p < other.m_ptr.p); } bool operator>(const CC_iterator& other) const { - std::cerr << ">"<< std::endl; - return (m_ptr.p > other.m_ptr.p); + return m_ptr.p->ts > other.m_ptr.p->ts; } bool operator<=(const CC_iterator& other) const { - std::cerr << "<="<< std::endl; - return (m_ptr.p <= other.m_ptr.p); + return m_ptr.p->ts <= other.m_ptr.p->ts; } bool operator>=(const CC_iterator& other) const { - std::cerr << ">="<< std::endl; - return (m_ptr.p >= other.m_ptr.p); + return m_ptr.p->ts >= other.m_ptr.p->ts; } // Can itself be used for bit-squatting. diff --git a/Triangulation_3/include/CGAL/Triangulation_data_structure_3.h b/Triangulation_3/include/CGAL/Triangulation_data_structure_3.h index 46e3af3eae9..5a733091c12 100644 --- a/Triangulation_3/include/CGAL/Triangulation_data_structure_3.h +++ b/Triangulation_3/include/CGAL/Triangulation_data_structure_3.h @@ -208,14 +208,12 @@ public: Vertex_handle create_vertex(const Vertex &v) { Vertex_handle vh = vertices().insert(v); - vh->ts = TS++; return vh; } Vertex_handle create_vertex() { Vertex_handle vh = vertices().emplace(); - vh->ts = TS++; return vh; } @@ -227,14 +225,12 @@ public: Cell_handle create_cell(const Cell &c) { Cell_handle ch = cells().insert(c); - ch->ts = TS++; return ch; } Cell_handle create_cell() { Cell_handle ch = cells().emplace(); - ch->ts = TS++; return ch; } @@ -247,7 +243,6 @@ public: Vertex_handle v2, Vertex_handle v3) { Cell_handle ch = cells().emplace(v0, v1, v2, v3); - ch->ts = TS++; return ch; } @@ -257,7 +252,6 @@ public: Cell_handle n2, Cell_handle n3) { Cell_handle ch = cells().emplace(v0, v1, v2, v3, n0, n1, n2, n3); - ch->ts = TS++; return ch; } @@ -272,7 +266,6 @@ public: { CGAL_triangulation_precondition(dimension()<3); Cell_handle ch = cells().emplace(v0, v1, v2, Vertex_handle()); - ch->ts = TS++; return ch; } @@ -3657,16 +3650,6 @@ count_cells(size_type & i, bool verbose, int level) const } - -template -bool - operator< (typename Triangulation_data_structure_3::Cell_handle a, typename Triangulation_data_structure_3::Cell_handle b) - { - std::cerr << "operator<" << std::endl; - return a->ts < b->ts; -} - - } //namespace CGAL #endif // CGAL_TRIANGULATION_DATA_STRUCTURE_3_H