diff options
author | Robin Gareus <robin@gareus.org> | 2019-11-18 15:09:43 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2019-11-18 15:55:17 +0100 |
commit | 3b2b946d4e95412c4e365319f411022afad6eece (patch) | |
tree | 55c2ae26ac2b798b7f95f6b3a3cde90c6e8e4d32 /libs/ardour/automatable.cc | |
parent | f49d11d5e306c8f053856e7c4bf85d1e320adcf4 (diff) |
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.
Diffstat (limited to 'libs/ardour/automatable.cc')
-rw-r--r-- | libs/ardour/automatable.cc | 7 |
1 files changed, 1 insertions, 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<AutomationControl> c, double sc->find_next_event (start, end, next_event); } - Evoral::ControlList::const_iterator i; boost::shared_ptr<const Evoral::ControlList> 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) { |