Code style tweak

This commit is contained in:
Maxime Coste 2017-11-03 21:51:10 +08:00
parent 9b216e0e79
commit aa9bcf08fc

View File

@ -56,19 +56,17 @@ void update_backward(ConstArrayView<Buffer::Change> changes, RangeContainer& ran
{ {
ForwardChangesTracker changes_tracker; ForwardChangesTracker changes_tracker;
using ReverseIt = std::reverse_iterator<const Buffer::Change*>; auto advance_while_relevant = [&, it = changes.rbegin(), end = changes.rend()]
auto change_it = ReverseIt(changes.end()); (const BufferCoord& pos) mutable {
auto change_end = ReverseIt(changes.begin()); while (it != end)
auto advance_while_relevant = [&](const BufferCoord& pos) mutable {
while (change_it != change_end)
{ {
auto change = *change_it; auto change = *it;
change.begin = changes_tracker.get_new_coord(change.begin); change.begin = changes_tracker.get_new_coord(change.begin);
change.end = changes_tracker.get_new_coord(change.end); change.end = changes_tracker.get_new_coord(change.end);
if (not changes_tracker.relevant(change, pos)) if (not changes_tracker.relevant(change, pos))
break; break;
changes_tracker.update(change); changes_tracker.update(change);
++change_it; ++it;
} }
}; };