Merge pull request #2230 from sgiraudot/Point_set_3-Bugfix_remove_index-GF

Point set 3: bug fix remove index
This commit is contained in:
Laurent Rineau 2017-07-17 11:45:16 +02:00
commit cc65b11d6d
2 changed files with 7 additions and 2 deletions

View File

@ -581,8 +581,7 @@ public:
*/ */
void remove (const Index& index) void remove (const Index& index)
{ {
std::swap (index, *(end() - 1)); remove (m_indices.begin() + index);
++ m_nb_removed;
} }

View File

@ -74,6 +74,12 @@ int main (int, char**)
point_set.collect_garbage(); point_set.collect_garbage();
test (!(point_set.has_garbage()), "point set shouldn't have garbage."); test (!(point_set.has_garbage()), "point set shouldn't have garbage.");
point_set.remove (*(point_set.begin()));
test (point_set.has_garbage(), "point set should have garbage.");
point_set.collect_garbage();
test (!(point_set.has_garbage()), "point set shouldn't have garbage.");
test (!(point_set.has_property_map<Color> ("color")), "point set shouldn't have colors."); test (!(point_set.has_property_map<Color> ("color")), "point set shouldn't have colors.");
Point_set::Property_map<Color> color_prop; Point_set::Property_map<Color> color_prop;
bool garbage; bool garbage;