From 31f96c3e0d13180447c45212158ee69e791c645a Mon Sep 17 00:00:00 2001 From: Arkadiy Illarionov Date: Sat, 9 Mar 2019 15:54:13 +0300 Subject: Simplify containers iterations in connectivity Use range-based loop or replace with STL functions Change-Id: I1f7c1ea19cdc8d450b7ed88a663ba9ccb3249304 Reviewed-on: https://gerrit.libreoffice.org/68974 Tested-by: Jenkins Reviewed-by: Noel Grandin --- connectivity/source/parse/sqlnode.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'connectivity/source/parse/sqlnode.cxx') diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx index b4890a25b46d..82b8c75b60e7 100644 --- a/connectivity/source/parse/sqlnode.cxx +++ b/connectivity/source/parse/sqlnode.cxx @@ -2401,13 +2401,13 @@ OSQLParseNode* OSQLParseNode::replace(OSQLParseNode* pOldSubNode, OSQLParseNode* pOldSubNode->setParent( nullptr ); pNewSubNode->setParent( this ); - for (auto it = m_aChildren.begin(); it != m_aChildren.end(); ++it) - if (it->get() == pOldSubNode) - { - it->release(); - it->reset(pNewSubNode); - break; - } + auto it = std::find_if(m_aChildren.begin(), m_aChildren.end(), + [&pOldSubNode](const std::unique_ptr& rxChild) { return rxChild.get() == pOldSubNode; }); + if (it != m_aChildren.end()) + { + it->release(); + it->reset(pNewSubNode); + } return pOldSubNode; } -- cgit