Fix sort_and_merge_overlapping
This commit is contained in:
parent
3f01f4bdf5
commit
44ca4d23de
|
@ -142,10 +142,10 @@ static void sort_and_merge_overlapping(SelectionList& selections)
|
||||||
Range back = selections.back();
|
Range back = selections.back();
|
||||||
auto back_rank = std::count_if(selections.begin(), selections.end(),
|
auto back_rank = std::count_if(selections.begin(), selections.end(),
|
||||||
[&](const Selection& sel)
|
[&](const Selection& sel)
|
||||||
{ return sel.begin() < back.begin(); });
|
{ return sel.begin() <= back.begin(); });
|
||||||
std::sort(selections.begin(), selections.end(), compare_selections);
|
std::stable_sort(selections.begin(), selections.end(), compare_selections);
|
||||||
if (back_rank < selections.size() - 1)
|
if (back_rank < selections.size() - 1)
|
||||||
std::rotate(selections.begin(), selections.begin() + back_rank + 1,
|
std::rotate(selections.begin(), selections.begin() + back_rank,
|
||||||
selections.end());
|
selections.end());
|
||||||
assert(selections.back() == back);
|
assert(selections.back() == back);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user