diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2015-05-12 19:54:36 +0900 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-05-13 10:50:47 +0000 |
commit | 19ba9e08cab4ff75595f53b9689989495ff5f625 (patch) | |
tree | f57962ba2676494201a874777329ed949a3f7be8 /slideshow/source/engine/shapes | |
parent | 595a109f8f5cd19cc72e1e44f2ae111427bb4330 (diff) |
slideshow: simplify code by replacing std::find_if by std::any_of/std::none_of
Change-Id: Ib8eec5074e82127e11f4fba2c0b143ab8cef3bcc
Reviewed-on: https://gerrit.libreoffice.org/15714
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'slideshow/source/engine/shapes')
-rw-r--r-- | slideshow/source/engine/shapes/backgroundshape.cxx | 10 | ||||
-rw-r--r-- | slideshow/source/engine/shapes/drawshape.cxx | 10 |
2 files changed, 8 insertions, 12 deletions
diff --git a/slideshow/source/engine/shapes/backgroundshape.cxx b/slideshow/source/engine/shapes/backgroundshape.cxx index f820a266295f..762c05c692b5 100644 --- a/slideshow/source/engine/shapes/backgroundshape.cxx +++ b/slideshow/source/engine/shapes/backgroundshape.cxx @@ -169,16 +169,14 @@ namespace slideshow void BackgroundShape::addViewLayer( const ViewLayerSharedPtr& rNewLayer, bool bRedrawLayer ) { - ViewBackgroundShapeVector::iterator aEnd( maViewShapes.end() ); - // already added? - if( ::std::find_if( maViewShapes.begin(), - aEnd, - ::boost::bind<bool>( + if( ::std::any_of( maViewShapes.begin(), + maViewShapes.end(), + ::boost::bind<bool>( ::std::equal_to< ViewLayerSharedPtr >(), ::boost::bind( &ViewBackgroundShape::getViewLayer, _1 ), - ::boost::cref( rNewLayer ) ) ) != aEnd ) + ::boost::cref( rNewLayer ) ) ) ) { // yes, nothing to do return; diff --git a/slideshow/source/engine/shapes/drawshape.cxx b/slideshow/source/engine/shapes/drawshape.cxx index 7c77a3c15f2b..875dffebb58c 100644 --- a/slideshow/source/engine/shapes/drawshape.cxx +++ b/slideshow/source/engine/shapes/drawshape.cxx @@ -632,16 +632,14 @@ namespace slideshow void DrawShape::addViewLayer( const ViewLayerSharedPtr& rNewLayer, bool bRedrawLayer ) { - ViewShapeVector::iterator aEnd( maViewShapes.end() ); - // already added? - if( ::std::find_if( maViewShapes.begin(), - aEnd, - ::boost::bind<bool>( + if( ::std::any_of( maViewShapes.begin(), + maViewShapes.end(), + ::boost::bind<bool>( ::std::equal_to< ViewLayerSharedPtr >(), ::boost::bind( &ViewShape::getViewLayer, _1 ), - ::boost::cref( rNewLayer ) ) ) != aEnd ) + ::boost::cref( rNewLayer ) ) )) { // yes, nothing to do return; |