diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2023-11-18 15:09:20 +0100 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2023-11-18 18:38:56 +0100 |
commit | 06e469623307821e8a1c4b0a3a2aa6f3dd202da6 (patch) | |
tree | 2701c5397f6a76ac7903a3e27b58547dcd7cf456 /package | |
parent | 597ba50a18ad9101cb5fa506b200fea12b580aa6 (diff) |
c++20: use std::erase(_if) instead of std::remove(_if)+erase (part 6)
Change-Id: Ic073d7444e968e90068aa60847bc9211167f6278
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159626
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'package')
-rw-r--r-- | package/source/manifest/ManifestImport.cxx | 3 | ||||
-rw-r--r-- | package/source/xstor/ohierarchyholder.cxx | 5 | ||||
-rw-r--r-- | package/source/xstor/owriteablestream.cxx | 2 | ||||
-rw-r--r-- | package/source/xstor/xstorage.cxx | 11 |
4 files changed, 9 insertions, 12 deletions
diff --git a/package/source/manifest/ManifestImport.cxx b/package/source/manifest/ManifestImport.cxx index 2c55bcf87fe9..195324fdbe2a 100644 --- a/package/source/manifest/ManifestImport.cxx +++ b/package/source/manifest/ManifestImport.cxx @@ -401,8 +401,7 @@ void SAL_CALL ManifestImport::endElement( const OUString& aName ) aSequence[PKG_SIZE_NOENCR_MNFST].Name = "KeyInfo"; aSequence[PKG_SIZE_NOENCR_MNFST].Value <<= comphelper::containerToSequence(aKeys); } - aSequence.erase(std::remove_if(aSequence.begin(), aSequence.end(), - isEmpty), aSequence.end()); + std::erase_if(aSequence, isEmpty); bIgnoreEncryptData = false; rManVector.push_back ( comphelper::containerToSequence(aSequence) ); diff --git a/package/source/xstor/ohierarchyholder.cxx b/package/source/xstor/ohierarchyholder.cxx index eafdf4a567f4..d9b5b137434d 100644 --- a/package/source/xstor/ohierarchyholder.cxx +++ b/package/source/xstor/ohierarchyholder.cxx @@ -262,10 +262,9 @@ void SAL_CALL OHierarchyElement_Impl::disposing( const lang::EventObject& Source std::unique_lock aGuard(m_aMutex); uno::Reference< embed::XExtendedStorageStream > xStream(Source.Source, uno::UNO_QUERY); - m_aOpenStreams.erase(std::remove_if(m_aOpenStreams.begin(), m_aOpenStreams.end(), + std::erase_if(m_aOpenStreams, [&xStream](const OWeakStorRefVector_Impl::value_type& rxStorage) { - return !rxStorage.get().is() || rxStorage.get() == xStream; }), - m_aOpenStreams.end()); + return !rxStorage.get().is() || rxStorage.get() == xStream; }); } TestForClosing(); diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index bd58f579a326..59e5e94316a3 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -1292,7 +1292,7 @@ uno::Reference< io::XInputStream > OWriteStream_Impl::GetRawInStream() void OWriteStream_Impl::InputStreamDisposed( OInputCompStream* pStream ) { ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); - m_aInputStreamsVector.erase(std::remove(m_aInputStreamsVector.begin(), m_aInputStreamsVector.end(), pStream ), m_aInputStreamsVector.end()); + std::erase(m_aInputStreamsVector, pStream); } void OWriteStream_Impl::CreateReadonlyCopyBasedOnData( const uno::Reference< io::XInputStream >& xDataToCopy, const uno::Sequence< beans::PropertyValue >& aProps, uno::Reference< io::XStream >& xTargetStream ) diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index e2c0207a1553..05150a48f988 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -1398,7 +1398,7 @@ SotElement_Impl* OStorage_Impl::InsertElement( const OUString& aName, bool bIsSt OpenSubStream( pDeletedElm ); auto & rVec = m_aChildrenMap[aName]; - rVec.erase(std::remove(rVec.begin(), rVec.end(), pDeletedElm), rVec.end()); + std::erase(rVec, pDeletedElm); if (rVec.empty()) m_aChildrenMap.erase(aName); m_aDeletedVector.push_back( pDeletedElm ); @@ -1493,7 +1493,7 @@ void OStorage_Impl::RemoveElement( OUString const & rName, SotElement_Impl* pEle if ( pElement->m_bIsInserted ) { delete pElement; - mapIt->second.erase(std::remove(mapIt->second.begin(), mapIt->second.end(), pElement), mapIt->second.end()); + std::erase(mapIt->second, pElement); if (mapIt->second.empty()) m_aChildrenMap.erase(mapIt); } @@ -1868,11 +1868,10 @@ void OStorage::ChildIsDisposed( const uno::Reference< uno::XInterface >& xChild // the locking is done in the listener auto& rVec = m_aOpenSubComponentsVector; - rVec.erase(std::remove_if(rVec.begin(), rVec.end(), + std::erase_if(rVec, [&xChild](const uno::Reference<lang::XComponent>& xTmp) { return !xTmp.is() || xTmp == xChild; - }), - rVec.end()); + }); } void OStorage::BroadcastModifiedIfNecessary() @@ -2860,7 +2859,7 @@ void SAL_CALL OStorage::renameElement( const OUString& aElementName, const OUStr for (auto it = rVec.begin(); it != rVec.end(); ++it) if (pElement == *it) { - rVec.erase(std::remove(rVec.begin(), rVec.end(), pElement), rVec.end()); + std::erase(rVec, pElement); if (rVec.empty()) m_pImpl->m_aChildrenMap.erase(mapIt); break; |