summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2023-11-19 20:57:35 +0100
committerJulien Nabet <serval2412@yahoo.fr>2023-11-20 07:39:42 +0100
commit15ef2909b88ef97b84615837e8bdb448481d61c1 (patch)
tree728ec60104cb96e16c5ffaa600380ca58c8fc639 /svx
parent31795be8ee5bcc113f2d18d315f842a89e95b316 (diff)
c++20: use std::erase(_if) instead of std::remove(_if)+erase (svx)
Change-Id: If0cca803cd182f5def098ab06a0c5a4a479758bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159702 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/diagram/datamodel.cxx14
-rw-r--r--svx/source/dialog/charmap.cxx5
-rw-r--r--svx/source/sdr/animation/scheduler.cxx2
-rw-r--r--svx/source/svdraw/svdhdl.cxx4
-rw-r--r--svx/source/svdraw/svdmark.cxx4
-rw-r--r--svx/source/unodraw/unoshcol.cxx2
-rw-r--r--svx/source/unodraw/unoshtxt.cxx2
-rw-r--r--svx/source/unogallery/unogaltheme.cxx2
8 files changed, 13 insertions, 22 deletions
diff --git a/svx/source/diagram/datamodel.cxx b/svx/source/diagram/datamodel.cxx
index 42677954bada..0cf0541cd2a1 100644
--- a/svx/source/diagram/datamodel.cxx
+++ b/svx/source/diagram/datamodel.cxx
@@ -125,18 +125,16 @@ bool DiagramData::removeNode(const OUString& rNodeId)
aIdsToRemove.insert(aCxn.msPresId);
// remove connections
- maConnections.erase(std::remove_if(maConnections.begin(), maConnections.end(),
+ std::erase_if(maConnections,
[aIdsToRemove](const Connection& rCxn) {
return aIdsToRemove.count(rCxn.msSourceId) || aIdsToRemove.count(rCxn.msDestId);
- }),
- maConnections.end());
+ });
// remove data and presentation nodes
- maPoints.erase(std::remove_if(maPoints.begin(), maPoints.end(),
+ std::erase_if(maPoints,
[aIdsToRemove](const Point& rPoint) {
return aIdsToRemove.count(rPoint.msModelId);
- }),
- maPoints.end());
+ });
// TODO: fix source/dest order
return true;
@@ -221,9 +219,7 @@ std::vector<std::pair<OUString, OUString>> DiagramData::getChildren(const OUStri
}
// HACK: empty items shouldn't appear there
- aChildren.erase(std::remove_if(aChildren.begin(), aChildren.end(),
- [](const std::pair<OUString, OUString>& aItem) { return aItem.first.isEmpty(); }),
- aChildren.end());
+ std::erase_if(aChildren, [](const std::pair<OUString, OUString>& aItem) { return aItem.first.isEmpty(); });
return aChildren;
}
diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx
index b8e10ad4e048..be2d991977b5 100644
--- a/svx/source/dialog/charmap.cxx
+++ b/svx/source/dialog/charmap.cxx
@@ -1946,14 +1946,13 @@ void SubsetMap::ApplyCharMap( const FontCharMapRef& rxFontCharMap )
return;
// remove subsets that are not matched in any range
- maSubsets.erase(std::remove_if(maSubsets.begin(), maSubsets.end(),
+ std::erase_if(maSubsets,
[&rxFontCharMap](const Subset& rSubset) {
sal_uInt32 cMin = rSubset.GetRangeMin();
sal_uInt32 cMax = rSubset.GetRangeMax();
int nCount = rxFontCharMap->CountCharsInRange( cMin, cMax );
return nCount <= 0;
- }),
- maSubsets.end());
+ });
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/animation/scheduler.cxx b/svx/source/sdr/animation/scheduler.cxx
index d4451c099a65..02017d915d97 100644
--- a/svx/source/sdr/animation/scheduler.cxx
+++ b/svx/source/sdr/animation/scheduler.cxx
@@ -154,7 +154,7 @@ namespace sdr::animation
{
if(!mvEvents.empty())
{
- mvEvents.erase(std::remove(mvEvents.begin(), mvEvents.end(), pOld), mvEvents.end());
+ std::erase(mvEvents, pOld);
checkTimeout();
}
}
diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx
index 90903acb29f8..867afa6a90b8 100644
--- a/svx/source/svdraw/svdhdl.cxx
+++ b/svx/source/svdraw/svdhdl.cxx
@@ -2239,9 +2239,7 @@ std::unique_ptr<SdrHdl> SdrHdlList::RemoveHdl(size_t nNum)
void SdrHdlList::RemoveAllByKind(SdrHdlKind eKind)
{
- maList.erase(std::remove_if(maList.begin(), maList.end(),
- [&eKind](std::unique_ptr<SdrHdl>& rItem) { return rItem->GetKind() == eKind; }),
- maList.end());
+ std::erase_if(maList, [&eKind](std::unique_ptr<SdrHdl>& rItem) { return rItem->GetKind() == eKind; });
}
void SdrHdlList::Clear()
diff --git a/svx/source/svdraw/svdmark.cxx b/svx/source/svdraw/svdmark.cxx
index c811a4d20aa5..521e56d44b9d 100644
--- a/svx/source/svdraw/svdmark.cxx
+++ b/svx/source/svdraw/svdmark.cxx
@@ -158,9 +158,7 @@ void SdrMarkList::ImpForceSort()
// remove invalid
if(nCount > 0 )
{
- maList.erase(std::remove_if(maList.begin(), maList.end(),
- [](std::unique_ptr<SdrMark>& rItem) { return rItem->GetMarkedSdrObj() == nullptr; }),
- maList.end());
+ std::erase_if(maList, [](std::unique_ptr<SdrMark>& rItem) { return rItem->GetMarkedSdrObj() == nullptr; });
nCount = maList.size();
}
diff --git a/svx/source/unodraw/unoshcol.cxx b/svx/source/unodraw/unoshcol.cxx
index 2cc6d39c88d7..42cf3fc5f164 100644
--- a/svx/source/unodraw/unoshcol.cxx
+++ b/svx/source/unodraw/unoshcol.cxx
@@ -150,7 +150,7 @@ void SAL_CALL SvxShapeCollection::add( const Reference< drawing::XShape >& xShap
void SAL_CALL SvxShapeCollection::remove( const uno::Reference< drawing::XShape >& xShape )
{
std::unique_lock g(m_aMutex);
- maShapeContainer.erase(std::remove(maShapeContainer.begin(), maShapeContainer.end(), xShape), maShapeContainer.end());
+ std::erase(maShapeContainer, xShape);
}
diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx
index 580b3c2f65a0..d3837e187b5d 100644
--- a/svx/source/unodraw/unoshtxt.cxx
+++ b/svx/source/unodraw/unoshtxt.cxx
@@ -236,7 +236,7 @@ void SvxTextEditSourceImpl::addRange( SvxUnoTextRangeBase* pNewRange )
void SvxTextEditSourceImpl::removeRange( SvxUnoTextRangeBase* pOldRange )
{
if( pOldRange )
- mvTextRanges.erase( std::remove(mvTextRanges.begin(), mvTextRanges.end(), pOldRange), mvTextRanges.end() );
+ std::erase(mvTextRanges, pOldRange);
}
diff --git a/svx/source/unogallery/unogaltheme.cxx b/svx/source/unogallery/unogaltheme.cxx
index f35548b634b7..0802d91a2e63 100644
--- a/svx/source/unogallery/unogaltheme.cxx
+++ b/svx/source/unogallery/unogaltheme.cxx
@@ -354,7 +354,7 @@ void GalleryTheme::implDeregisterGalleryItem( ::unogallery::GalleryItem& rItem )
{
const SolarMutexGuard aGuard;
- maItemVector.erase(std::remove(maItemVector.begin(), maItemVector.end(), &rItem), maItemVector.end());
+ std::erase(maItemVector, &rItem);
}
}