c++20: use std::erase(_if) instead of std::remove(_if)+erase (part 11)
Change-Id: I2197c65248a96caa8ae621d5b1d16aa1086fc525 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159643 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
This commit is contained in:
parent
7ad4641e79
commit
8158f016ea
13 changed files with 66 additions and 38 deletions
|
@ -134,13 +134,11 @@ void PointerSymbol::viewAdded( const UnoViewSharedPtr& rView )
|
|||
|
||||
void PointerSymbol::viewRemoved( const UnoViewSharedPtr& rView )
|
||||
{
|
||||
maViews.erase(
|
||||
std::remove_if(
|
||||
maViews.begin(), maViews.end(),
|
||||
std::erase_if(
|
||||
maViews,
|
||||
[&rView]
|
||||
( const ViewsVecT::value_type& cp )
|
||||
{ return rView == cp.first; } ),
|
||||
maViews.end() );
|
||||
{ return rView == cp.first; } );
|
||||
}
|
||||
|
||||
void PointerSymbol::viewChanged( const UnoViewSharedPtr& rView )
|
||||
|
|
|
@ -349,12 +349,11 @@ void RehearseTimingsActivity::viewAdded( const UnoViewSharedPtr& rView )
|
|||
|
||||
void RehearseTimingsActivity::viewRemoved( const UnoViewSharedPtr& rView )
|
||||
{
|
||||
maViews.erase(
|
||||
std::remove_if( maViews.begin(), maViews.end(),
|
||||
std::erase_if(
|
||||
maViews,
|
||||
[&rView]
|
||||
( const ViewsVecT::value_type& cp )
|
||||
{ return rView == cp.first; } ),
|
||||
maViews.end() );
|
||||
{ return rView == cp.first; } );
|
||||
}
|
||||
|
||||
void RehearseTimingsActivity::viewChanged( const UnoViewSharedPtr& rView )
|
||||
|
|
|
@ -184,6 +184,8 @@ namespace slideshow::internal
|
|||
{ return rLayer == pShape->getViewLayer(); } ) < 2,
|
||||
"AppletShape::removeViewLayer(): Duplicate ViewLayer entries!" );
|
||||
|
||||
// TODO : needed for the moment since ANDROID doesn't know size_t return from std::erase_if
|
||||
#if defined ANDROID
|
||||
ViewAppletShapeVector::iterator aIter;
|
||||
|
||||
if( (aIter=::std::remove_if( maViewAppletShapes.begin(),
|
||||
|
@ -200,6 +202,14 @@ namespace slideshow::internal
|
|||
maViewAppletShapes.erase( aIter, aEnd );
|
||||
|
||||
return true;
|
||||
#else
|
||||
size_t nb = std::erase_if(maViewAppletShapes,
|
||||
[&rLayer]
|
||||
( const ViewAppletShapeSharedPtr& pShape )
|
||||
{ return rLayer == pShape->getViewLayer(); } );
|
||||
// if nb == 0, it means view layer seemingly was not added, failed
|
||||
return (nb != 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -187,6 +187,8 @@ namespace slideshow::internal
|
|||
{ return pBgShape->getViewLayer() == rLayer; } ) < 2,
|
||||
"BackgroundShape::removeViewLayer(): Duplicate ViewLayer entries!" );
|
||||
|
||||
// TODO : needed for the moment since ANDROID doesn't know size_t return from std::erase_if
|
||||
#if defined ANDROID
|
||||
ViewBackgroundShapeVector::iterator aIter;
|
||||
|
||||
if( (aIter=::std::remove_if( maViewShapes.begin(),
|
||||
|
@ -202,6 +204,14 @@ namespace slideshow::internal
|
|||
maViewShapes.erase( aIter, aEnd );
|
||||
|
||||
return true;
|
||||
#else
|
||||
|
||||
size_t nb = std::erase_if(maViewShapes,
|
||||
[&rLayer]( const ViewBackgroundShapeSharedPtr& pBgShape )
|
||||
{ return pBgShape->getViewLayer() == rLayer; } );
|
||||
// if nb == 0, it means view shape seemingly was not added, failed
|
||||
return (nb != 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void BackgroundShape::clearAllViewLayers()
|
||||
|
|
|
@ -659,6 +659,9 @@ namespace slideshow::internal
|
|||
{ return rLayer == pShape->getViewLayer(); } ) < 2,
|
||||
"DrawShape::removeViewLayer(): Duplicate ViewLayer entries!" );
|
||||
|
||||
|
||||
// TODO : needed for the moment since ANDROID doesn't know size_t return from std::erase_if
|
||||
#if defined ANDROID
|
||||
ViewShapeVector::iterator aIter;
|
||||
|
||||
if( (aIter=::std::remove_if( maViewShapes.begin(),
|
||||
|
@ -675,6 +678,14 @@ namespace slideshow::internal
|
|||
maViewShapes.erase( aIter, aEnd );
|
||||
|
||||
return true;
|
||||
#else
|
||||
size_t nb = std::erase_if(maViewShapes,
|
||||
[&rLayer]
|
||||
( const ViewShapeSharedPtr& pShape )
|
||||
{ return rLayer == pShape->getViewLayer(); } );
|
||||
// if nb == 0, it means view shape seemingly was not added, failed
|
||||
return (nb != 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DrawShape::clearAllViewLayers()
|
||||
|
|
|
@ -149,6 +149,8 @@ namespace slideshow::internal
|
|||
{ return rLayer == pShape->getViewLayer(); } ) < 2,
|
||||
"MediaShape::removeViewLayer(): Duplicate ViewLayer entries!" );
|
||||
|
||||
// TODO : needed for the moment since ANDROID doesn't know size_t return from std::erase_if
|
||||
#if defined ANDROID
|
||||
ViewMediaShapeVector::iterator aIter;
|
||||
|
||||
if( (aIter=::std::remove_if( maViewMediaShapes.begin(),
|
||||
|
@ -165,6 +167,14 @@ namespace slideshow::internal
|
|||
maViewMediaShapes.erase( aIter, aEnd );
|
||||
|
||||
return true;
|
||||
#else
|
||||
size_t nb = std::erase_if(maViewMediaShapes,
|
||||
[&rLayer]
|
||||
( const ViewMediaShapeSharedPtr& pShape )
|
||||
{ return rLayer == pShape->getViewLayer(); } );
|
||||
// if nb == 0, it means view media shape seemingly was not added, failed
|
||||
return (nb != 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -601,14 +601,10 @@ void SlideImpl::viewRemoved( const UnoViewSharedPtr& rView )
|
|||
if( mpLayerManager )
|
||||
mpLayerManager->viewRemoved( rView );
|
||||
|
||||
const VectorOfVectorOfSlideBitmaps::iterator aEnd( maSlideBitmaps.end() );
|
||||
maSlideBitmaps.erase(
|
||||
std::remove_if( maSlideBitmaps.begin(),
|
||||
aEnd,
|
||||
std::erase_if(maSlideBitmaps,
|
||||
[&rView]
|
||||
( const VectorOfVectorOfSlideBitmaps::value_type& cp )
|
||||
{ return rView == cp.first; } ),
|
||||
aEnd );
|
||||
{ return rView == cp.first; } );
|
||||
}
|
||||
|
||||
void SlideImpl::viewChanged( const UnoViewSharedPtr& rView )
|
||||
|
|
|
@ -89,9 +89,7 @@ namespace slideshow::internal
|
|||
|
||||
virtual void viewRemoved( const UnoViewSharedPtr& rView ) override
|
||||
{
|
||||
maViews.erase( ::std::remove( maViews.begin(),
|
||||
maViews.end(),
|
||||
rView ) );
|
||||
std::erase(maViews, rView);
|
||||
}
|
||||
|
||||
virtual void viewChanged( const UnoViewSharedPtr& /*rView*/ ) override
|
||||
|
|
|
@ -124,10 +124,7 @@ void SlideOverlayButton::viewAdded(const UnoViewSharedPtr& rView)
|
|||
|
||||
void SlideOverlayButton::viewRemoved(const UnoViewSharedPtr& rView)
|
||||
{
|
||||
maViews.erase(
|
||||
std::remove_if(maViews.begin(), maViews.end(),
|
||||
[&rView](const ViewsVecT::value_type& cp) { return rView == cp.first; }),
|
||||
maViews.end());
|
||||
std::erase_if(maViews, [&rView](const ViewsVecT::value_type& cp) { return rView == cp.first; });
|
||||
}
|
||||
|
||||
void SlideOverlayButton::viewChanged(const UnoViewSharedPtr& rView)
|
||||
|
|
|
@ -404,13 +404,9 @@ void SlideChangeBase::viewRemoved( const UnoViewSharedPtr& rView )
|
|||
return;
|
||||
|
||||
// erase corresponding entry from maViewData
|
||||
maViewData.erase(
|
||||
std::remove_if(
|
||||
maViewData.begin(),
|
||||
maViewData.end(),
|
||||
std::erase_if(maViewData,
|
||||
[rView]( const ViewEntry& rViewEntry )
|
||||
{ return rView == rViewEntry.getView(); } ),
|
||||
maViewData.end() );
|
||||
{ return rView == rViewEntry.getView(); } );
|
||||
}
|
||||
|
||||
void SlideChangeBase::viewChanged( const UnoViewSharedPtr& rView )
|
||||
|
|
|
@ -138,13 +138,11 @@ void WaitSymbol::viewAdded( const UnoViewSharedPtr& rView )
|
|||
|
||||
void WaitSymbol::viewRemoved( const UnoViewSharedPtr& rView )
|
||||
{
|
||||
maViews.erase(
|
||||
std::remove_if(
|
||||
maViews.begin(), maViews.end(),
|
||||
std::erase_if(
|
||||
maViews,
|
||||
[&rView]
|
||||
( const ViewsVecT::value_type& cp )
|
||||
{ return rView == cp.first; } ),
|
||||
maViews.end() );
|
||||
{ return rView == cp.first; } );
|
||||
}
|
||||
|
||||
void WaitSymbol::viewChanged( const UnoViewSharedPtr& rView )
|
||||
|
|
|
@ -299,6 +299,8 @@ public:
|
|||
{
|
||||
Guard aGuard(*this);
|
||||
|
||||
// TODO : needed for the moment since ANDROID doesn't know size_t return from std::erase
|
||||
#if defined ANDROID
|
||||
const typename container_type::iterator aEnd( maListeners.end() );
|
||||
typename container_type::iterator aIter;
|
||||
if( (aIter=std::remove(maListeners.begin(),
|
||||
|
@ -311,6 +313,11 @@ public:
|
|||
maListeners.erase( aIter, aEnd );
|
||||
|
||||
return true;
|
||||
#else
|
||||
size_t nb = std::erase(maListeners, rListener);
|
||||
// if nb == 0, it means listener wasn't found
|
||||
return (nb != 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Removes all listeners in one go
|
||||
|
|
|
@ -126,13 +126,11 @@ private:
|
|||
{ return cp.first == rNewLayer; } ) )
|
||||
throw std::exception();
|
||||
|
||||
maViewLayers.erase(
|
||||
std::remove_if(
|
||||
maViewLayers.begin(),
|
||||
maViewLayers.end(),
|
||||
std::erase_if(
|
||||
maViewLayers,
|
||||
[&rNewLayer]
|
||||
( const ViewVector::value_type& cp )
|
||||
{ return cp.first == rNewLayer; } ) );
|
||||
{ return cp.first == rNewLayer; } );
|
||||
return true;
|
||||
}
|
||||
virtual void clearAllViewLayers() override
|
||||
|
|
Loading…
Reference in a new issue