Better remove() / is_removed() methods

This commit is contained in:
Simon Giraudot 2018-07-17 12:09:15 +02:00
parent 6c6244d9b8
commit e11e12b69f
1 changed files with 12 additions and 1 deletions

View File

@ -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.