diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-03-13 21:11:09 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-03-16 20:16:46 +0100 |
commit | 10a48c737d347bcce765c8fbe009bc1dd0bb0c4d (patch) | |
tree | 6688e9ca36964bcbf589e60452a331b49a81bfde /basic/source/sbx | |
parent | bb9728bbf9bb29ef2b6ca582a382f66e9adf2623 (diff) |
Simplify containers iterations in basctl, basegfx, basic, bridges
Use range-based loop or replace with STL functions
Change-Id: I8594740103bdc2091c2d03d4b92bbe8393f5378c
Reviewed-on: https://gerrit.libreoffice.org/69223
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic/source/sbx')
-rw-r--r-- | basic/source/sbx/sbxbase.cxx | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/basic/source/sbx/sbxbase.cxx b/basic/source/sbx/sbxbase.cxx index 80508a155826..22dbb951c145 100644 --- a/basic/source/sbx/sbxbase.cxx +++ b/basic/source/sbx/sbxbase.cxx @@ -123,15 +123,13 @@ void SbxBase::AddFactory( SbxFactory* pFac ) void SbxBase::RemoveFactory( SbxFactory const * pFac ) { SbxAppData& r = GetSbxData_Impl(); - for (auto it = r.m_Factories.begin(); it != r.m_Factories.end(); ++it) + auto it = std::find_if(r.m_Factories.begin(), r.m_Factories.end(), + [&pFac](const std::unique_ptr<SbxFactory>& rxFactory) { return rxFactory.get() == pFac; }); + if (it != r.m_Factories.end()) { - if ((*it).get() == pFac) - { - std::unique_ptr<SbxFactory> tmp(std::move(*it)); - r.m_Factories.erase( it ); - (void)tmp.release(); - break; - } + std::unique_ptr<SbxFactory> tmp(std::move(*it)); + r.m_Factories.erase( it ); + (void)tmp.release(); } } |