From e11e12b69f960822cb66d55887bb9d0cfadf9fbd Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Tue, 17 Jul 2018 12:09:15 +0200 Subject: [PATCH] Better remove() / is_removed() methods --- Point_set_3/include/CGAL/Point_set_3.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Point_set_3/include/CGAL/Point_set_3.h b/Point_set_3/include/CGAL/Point_set_3.h index fa44d2404ee..84aa7ed209a 100644 --- a/Point_set_3/include/CGAL/Point_set_3.h +++ b/Point_set_3/include/CGAL/Point_set_3.h @@ -590,7 +590,10 @@ public: */ void remove (const Index& index) { - remove (m_indices.begin() + index); + iterator it = m_indices.begin() + index; + while (*it != index) + it = m_indices.begin() + *it; + remove (it); } @@ -610,6 +613,14 @@ public: return (std::distance (it, garbage_begin()) <= 0); } + bool is_removed (const Index& index) const + { + const_iterator it = m_indices.begin() + index; + while (*it != index) + it = m_indices.begin() + *it; + return is_removed (it); + } + /*! \brief Returns the constant iterator to the first element marked as removed (equal to `garbage_end()` if no elements are marked as removed.