From 587ef41f75b8ea0bcd03366178d42a324dcf481c Mon Sep 17 00:00:00 2001 From: Arkadiy Illarionov Date: Sun, 18 Nov 2018 13:43:28 +0300 Subject: Simplify containers iterations in svx/source/[s-u]* Use range-based loop or replace with STL functions Change-Id: I2ec3e58cc46c9286ef863c732912ca7a729bab62 Reviewed-on: https://gerrit.libreoffice.org/63522 Tested-by: Jenkins Reviewed-by: Noel Grandin --- svx/source/sdr/animation/scheduler.cxx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'svx/source/sdr/animation/scheduler.cxx') diff --git a/svx/source/sdr/animation/scheduler.cxx b/svx/source/sdr/animation/scheduler.cxx index a8fc3272be8b..4f32f101f999 100644 --- a/svx/source/sdr/animation/scheduler.cxx +++ b/svx/source/sdr/animation/scheduler.cxx @@ -88,12 +88,10 @@ namespace sdr } // execute events from the vector - ::std::vector< Event* >::const_iterator aEnd = aToBeExecutedList.end(); - for(::std::vector< Event* >::iterator aCandidate = aToBeExecutedList.begin(); - aCandidate != aEnd; ++aCandidate) + for(auto& rpCandidate : aToBeExecutedList) { // trigger event. This may re-insert the event to the scheduler again - (*aCandidate)->Trigger(mnTime); + rpCandidate->Trigger(mnTime); } } @@ -146,9 +144,8 @@ namespace sdr void Scheduler::InsertEvent(Event& rNew) { // insert maintaining time ordering - auto it = mvEvents.begin(); - while (it != mvEvents.end() && rNew.GetTime() >= (*it)->GetTime()) - it++; + auto it = std::find_if(mvEvents.begin(), mvEvents.end(), + [&rNew](const Event* pEvent) { return rNew.GetTime() < pEvent->GetTime(); }); mvEvents.insert(it, &rNew); checkTimeout(); } -- cgit