summaryrefslogtreecommitdiff
path: root/cppuhelper/source/weak.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'cppuhelper/source/weak.cxx')
-rw-r--r--cppuhelper/source/weak.cxx12
1 files changed, 6 insertions, 6 deletions
diff --git a/cppuhelper/source/weak.cxx b/cppuhelper/source/weak.cxx
index 57f22880adfc..cfb455f54488 100644
--- a/cppuhelper/source/weak.cxx
+++ b/cppuhelper/source/weak.cxx
@@ -183,14 +183,14 @@ void SAL_CALL OWeakConnectionPoint::removeReference(const Reference< XReference
// Search from end because the thing that last added a ref is most likely to be the
// first to remove a ref.
// It's not really valid to compare the pointer directly, but it's faster.
- for (auto it = m_aReferences.rbegin(); it != m_aReferences.rend(); ++it) {
- if (it->get() == rRef.get()) {
- m_aReferences.erase( it.base()-1 );
- return;
- }
+ auto it = std::find_if(m_aReferences.rbegin(), m_aReferences.rend(),
+ [&rRef](const Reference<XReference>& rxRef) { return rxRef.get() == rRef.get(); });
+ if (it != m_aReferences.rend()) {
+ m_aReferences.erase( it.base()-1 );
+ return;
}
// interface not found, use the correct compare method
- auto it = std::find(m_aReferences.rbegin(), m_aReferences.rend(), rRef);
+ it = std::find(m_aReferences.rbegin(), m_aReferences.rend(), rRef);
if ( it != m_aReferences.rend() )
m_aReferences.erase( it.base()-1 );
}