From 0787ce8814e37972a0c968f60008d4e8722b6e27 Mon Sep 17 00:00:00 2001 From: Arkadiy Illarionov Date: Wed, 15 Aug 2018 21:32:27 +0300 Subject: Simplify containers iterations, tdf#96099 follow-up Use range-based loop or replace with std::any_of, std::find and std::find_if where applicable. Change-Id: I2f80788c49d56094c29b102eb96a7a7c079567c6 Reviewed-on: https://gerrit.libreoffice.org/59143 Tested-by: Jenkins Reviewed-by: Michael Meeks Reviewed-by: Noel Grandin --- configmgr/source/modifications.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'configmgr/source') diff --git a/configmgr/source/modifications.cxx b/configmgr/source/modifications.cxx index f385fc3215bc..d84904c3f14e 100644 --- a/configmgr/source/modifications.cxx +++ b/configmgr/source/modifications.cxx @@ -34,13 +34,13 @@ Modifications::~Modifications() {} void Modifications::add(std::vector const & path) { Node * p = &root_; bool wasPresent = false; - for (auto i(path.begin()); i != path.end(); ++i) { - Node::Children::iterator j(p->children.find(*i)); + for (auto const& pathItem : path) { + Node::Children::iterator j(p->children.find(pathItem)); if (j == p->children.end()) { if (wasPresent && p->children.empty()) { return; } - j = p->children.emplace(*i, Node()).first; + j = p->children.emplace(pathItem, Node()).first; wasPresent = false; } else { wasPresent = true; -- cgit