From 3b2b946d4e95412c4e365319f411022afad6eece Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 18 Nov 2019 15:09:43 +0100 Subject: [PATCH] NO-OP: simplify code find_next_ac_event, needs to find the next event *after* (but not at) start. std::upper_bound returns an iterator pointing to the first element in the range [first, last) that is greater than value. This is equivalent to using std::lower_bound an iterating until finding the first element greater than. --- libs/ardour/automatable.cc | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/libs/ardour/automatable.cc b/libs/ardour/automatable.cc index 47945326ff..b83be5b45a 100644 --- a/libs/ardour/automatable.cc +++ b/libs/ardour/automatable.cc @@ -661,18 +661,13 @@ Automatable::find_next_ac_event (boost::shared_ptr c, double sc->find_next_event (start, end, next_event); } - Evoral::ControlList::const_iterator i; boost::shared_ptr alist (c->list()); Evoral::ControlEvent cp (start, 0.0f); if (!alist) { return; } - for (i = lower_bound (alist->begin(), alist->end(), &cp, Evoral::ControlList::time_comparator); i != alist->end() && (*i)->when < end; ++i) { - if ((*i)->when > start) { - break; - } - } + Evoral::ControlList::const_iterator i = upper_bound (alist->begin(), alist->end(), &cp, Evoral::ControlList::time_comparator); if (i != alist->end() && (*i)->when < end) { if ((*i)->when < next_event.when) {