From fbe59eb1913a779115d9c4769a4066d08e30ff44 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 8 May 2015 00:25:20 +0200 Subject: better fix, using std::remove instead of std::erase (bzr r14122) --- src/path-chemistry.cpp | 8 ++------ src/selection-chemistry.cpp | 16 ++++------------ src/ui/tools/eraser-tool.cpp | 4 +--- 3 files changed, 7 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index 98148b916..ff307cd66 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -388,9 +388,7 @@ sp_item_list_to_curves(const std::vector &items, std::vector& if (repr) { to_select.insert(to_select.begin(),repr); did = true; - std::vector::iterator element=find(selected.begin(),selected.end(),item); - if(element != selected.end()) - selected.erase(find(selected.begin(),selected.end(),item)); + remove(selected.begin(),selected.end(),item); } continue; @@ -415,9 +413,7 @@ sp_item_list_to_curves(const std::vector &items, std::vector& continue; did = true; - std::vector::iterator element=find(selected.begin(),selected.end(),item); - if(element != selected.end()) - selected.erase(element); + remove(selected.begin(),selected.end(),item); // remember the position of the item gint pos = item->getRepr()->position(); diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 3a68b03e5..1e3afc6a8 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -3922,9 +3922,7 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ for (GSList *i = apply_to_items ; NULL != i ; i = i->next) { reprs_to_group.push_back(static_cast(i->data)->getRepr()); - std::vector::iterator element = find(items_to_select.begin(),items_to_select.end(),static_cast(i->data)); - if(element != items_to_select.end()) - items_to_select.erase(element); + remove(items_to_select.begin(),items_to_select.end(),static_cast(i->data)); } sp_selection_group_impl(reprs_to_group, group, xml_doc, doc); @@ -3974,9 +3972,7 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ Inkscape::XML::Node *spnew = current->duplicate(xml_doc); gint position = current->position(); - std::vector::iterator element = find(items_to_select.begin(),items_to_select.end(),item); - if(element != items_to_select.end()) - items_to_select.erase(element); + remove(items_to_select.begin(),items_to_select.end(),item); current->parent()->appendChild(group); sp_repr_unparent(current); group->appendChild(spnew); @@ -4000,9 +3996,7 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_ for (GSList *i = items_to_delete; NULL != i; i = i->next) { SPObject *item = reinterpret_cast(i->data); item->deleteObject(false); - std::vector::iterator element = find(items_to_select.begin(),items_to_select.end(),item); - if(element != items_to_select.end()) - items_to_select.erase(element); + remove(items_to_select.begin(),items_to_select.end(),item); } g_slist_free(items_to_delete); @@ -4127,9 +4121,7 @@ void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path) { for (GSList *i = items_to_ungroup ; NULL != i ; i = i->next) { SPGroup *group = dynamic_cast(static_cast(i->data)); if (group) { - std::vector::iterator element = find(items_to_select.begin(),items_to_select.end(),group); - if(element != items_to_select.end()) - items_to_select.erase(element); + remove(items_to_select.begin(),items_to_select.end(),group); std::vector children; sp_item_group_ungroup(group, children, false); items_to_select.insert(items_to_select.end(),children.rbegin(),children.rend()); diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp index 0af347bef..8a9db6c72 100644 --- a/src/ui/tools/eraser-tool.cpp +++ b/src/ui/tools/eraser-tool.cpp @@ -674,9 +674,7 @@ void EraserTool::set_to_accumulated() { Inkscape::Rubberband *r = Inkscape::Rubberband::get(desktop); toWorkOn = desktop->getDocument()->getItemsAtPoints(desktop->dkey, r->getPoints()); } - std::vector::iterator element = find(toWorkOn.begin(),toWorkOn.end(),acid); - if(element != toWorkOn.end()) - toWorkOn.erase(element); + std::remove(toWorkOn.begin(),toWorkOn.end(),acid); } else { toWorkOn= selection->itemList(); wasSelection = true; -- cgit v1.2.3