From e82ca36117d98a884571798785b4e0d801229491 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 4 Nov 2015 19:43:25 +0000 Subject: [PATCH] Avoid unneeded sort_and_merge_ovelapping call in select_all_matches --- src/selectors.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/selectors.cc b/src/selectors.cc index 99f4f95a..bf44c186 100644 --- a/src/selectors.cc +++ b/src/selectors.cc @@ -590,7 +590,10 @@ void select_all_matches(SelectionList& selections, const Regex& regex) } if (result.empty()) throw runtime_error("nothing selected"); - selections = std::move(result); + + // Avoid SelectionList::operator=(Vector) as we know result is + // already sorted and non overlapping. + selections = SelectionList{buffer, std::move(result)}; } void split_selections(SelectionList& selections, const Regex& regex)