From 169dff19d4da8d76e69b8e896aa25b0013639c03 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Wed, 2 Jan 2019 10:41:30 +0100 Subject: modernize loops --- src/attribute-sort-util.cpp | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'src/attribute-sort-util.cpp') diff --git a/src/attribute-sort-util.cpp b/src/attribute-sort-util.cpp index 6dad86007..0e6203ce9 100644 --- a/src/attribute-sort-util.cpp +++ b/src/attribute-sort-util.cpp @@ -110,18 +110,16 @@ void sp_attribute_sort_element(Node *repr) { std::sort(my_list.begin(), my_list.end(), cmp); // Delete all attributes. //for (auto it: my_list) { - for (std::vector >::iterator it = my_list.begin(); - it != my_list.end(); ++it) { + for (auto & it : my_list) { // Removing "inkscape:label" results in crash when Layers dialog is open. - if (it->first != "inkscape:label") { - repr->setAttribute( it->first.c_str(), nullptr, false ); + if (it.first != "inkscape:label") { + repr->setAttribute( it.first.c_str(), nullptr, false ); } } // Insert all attributes in proper order - for (std::vector >::iterator it = my_list.begin(); - it != my_list.end(); ++it) { - if (it->first != "inkscape:label") { - repr->setAttribute( it->first.c_str(), it->second.c_str(), false ); + for (auto & it : my_list) { + if (it.first != "inkscape:label") { + repr->setAttribute( it.first.c_str(), it.second.c_str(), false ); } } } @@ -197,14 +195,12 @@ void sp_attribute_sort_style(Node* repr, SPCSSAttr *css) { std::sort(my_list.begin(), my_list.end(), cmp); // Delete all attributes. //for (auto it: my_list) { - for (std::vector >::iterator it = my_list.begin(); - it != my_list.end(); ++it) { - sp_repr_css_set_property( css, it->first.c_str(), nullptr ); + for (auto & it : my_list) { + sp_repr_css_set_property( css, it.first.c_str(), nullptr ); } // Insert all attributes in proper order - for (std::vector >::iterator it = my_list.begin(); - it != my_list.end(); ++it) { - sp_repr_css_set_property( css, it->first.c_str(), it->second.c_str() ); + for (auto & it : my_list) { + sp_repr_css_set_property( css, it.first.c_str(), it.second.c_str() ); } } -- cgit v1.2.3