From 5a7c1bc635c7e0377bb743d91b0cf385397b7337 Mon Sep 17 00:00:00 2001 From: Takeshi Abe Date: Mon, 4 May 2015 09:33:59 +0900 Subject: simplify code by replacing std::find_if with std::any_of/std::none_of MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ife6ab3544f73b1de60f5241c68466045161a4d88 Reviewed-on: https://gerrit.libreoffice.org/15615 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- basegfx/source/range/b2dpolyrange.cxx | 4 ++-- canvas/source/factory/cf_service.cxx | 8 ++++---- canvas/source/tools/spriteredrawmanager.cxx | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/basegfx/source/range/b2dpolyrange.cxx b/basegfx/source/range/b2dpolyrange.cxx index 3722ca467bc3..3aec84dd6040 100644 --- a/basegfx/source/range/b2dpolyrange.cxx +++ b/basegfx/source/range/b2dpolyrange.cxx @@ -80,11 +80,11 @@ namespace basegfx return false; const std::vector::const_iterator aEnd( maRanges.end() ); - return std::find_if( maRanges.begin(), + return std::any_of( maRanges.begin(), aEnd, boost::bind( boost::mem_fn( &B2DRange::overlaps ), _1, - boost::cref(rRange) ) ) != aEnd; + boost::cref(rRange) ) ); } B2DPolyPolygon solveCrossovers() const diff --git a/canvas/source/factory/cf_service.cxx b/canvas/source/factory/cf_service.cxx index 3f3c24ef8cd0..427acb7948c4 100644 --- a/canvas/source/factory/cf_service.cxx +++ b/canvas/source/factory/cf_service.cxx @@ -401,24 +401,24 @@ Reference CanvasFactory::lookupAndUse( // check whether given canvas service is listed in the // sequence of "accelerated canvas implementations" const bool bIsAcceleratedImpl( - std::find_if(pFirstAccelImpl, + std::any_of(pFirstAccelImpl, pEndAccelImpl, boost::bind(&OUString::equals, boost::cref(aCurrName), boost::bind( &OUString::trim, - _1))) != pEndAccelImpl ); + _1))) ); // check whether given canvas service is listed in the // sequence of "antialiasing canvas implementations" const bool bIsAAImpl( - std::find_if(pFirstAAImpl, + std::any_of(pFirstAAImpl, pEndAAImpl, boost::bind(&OUString::equals, boost::cref(aCurrName), boost::bind( &OUString::trim, - _1))) != pEndAAImpl ); + _1))) ); // try to instantiate canvas *only* if either accel and AA // property match preference, *or*, if there's a mismatch, only diff --git a/canvas/source/tools/spriteredrawmanager.cxx b/canvas/source/tools/spriteredrawmanager.cxx index 7873883c276a..a98a65e261c1 100644 --- a/canvas/source/tools/spriteredrawmanager.cxx +++ b/canvas/source/tools/spriteredrawmanager.cxx @@ -423,12 +423,12 @@ namespace canvas // and check whether _any_ of the sprites tells that its area // update will not be opaque. - return (::std::find_if( rUpdateArea.maComponentList.begin(), + return ::std::none_of( rUpdateArea.maComponentList.begin(), aEnd, ::boost::bind( &SpriteRedrawManager::isAreaUpdateNotOpaque, this, ::boost::cref(aTrueArea), - _1 ) ) == aEnd ); + _1 ) ); } bool SpriteRedrawManager::areSpritesChanged( const UpdateArea& rUpdateArea ) const @@ -440,12 +440,12 @@ namespace canvas // component (return false) const SpriteConnectedRanges::ComponentListType::const_iterator aEnd( rUpdateArea.maComponentList.end() ); - return (::std::find_if( rUpdateArea.maComponentList.begin(), + return ::std::any_of( rUpdateArea.maComponentList.begin(), aEnd, ::boost::bind( &SpriteInfo::needsUpdate, ::boost::bind( ::o3tl::select2nd(), - _1 ) ) ) != aEnd ); + _1 ) ) ); } SpriteRedrawManager::SpriteRedrawManager() : -- cgit