diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-03-09 15:54:13 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-03-09 18:31:12 +0100 |
commit | 31f96c3e0d13180447c45212158ee69e791c645a (patch) | |
tree | 3ec7744b25a3929cafd4bbdffd018a5036055ad7 /connectivity/source/parse | |
parent | 4e25914b165d7ed64b3026af758fb857676aacd5 (diff) |
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'connectivity/source/parse')
-rw-r--r-- | connectivity/source/parse/sqlnode.cxx | 14 |
1 files changed, 7 insertions, 7 deletions
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<OSQLParseNode>& rxChild) { return rxChild.get() == pOldSubNode; }); + if (it != m_aChildren.end()) + { + it->release(); + it->reset(pNewSubNode); + } return pOldSubNode; } |