From d024bec2477f54df97490bcb758279c213033e2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Mon, 21 Aug 2023 01:20:00 +0200 Subject: [PATCH] Use constInsert template --- src/util/rangelist.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/util/rangelist.cpp b/src/util/rangelist.cpp index d14a6214118..e1c59ae5c98 100644 --- a/src/util/rangelist.cpp +++ b/src/util/rangelist.cpp @@ -4,6 +4,7 @@ #include #include "util/assert.h" +#include "util/make_const_iterator.h" namespace { @@ -36,9 +37,9 @@ QList parseRangeList(const QString& input) { } for (int currentIndex = startIndex; currentIndex <= endIndex; currentIndex++) { // Add values sorted and skip duplicates - auto insertPos = std::lower_bound(intList.begin(), intList.end(), currentIndex); - if (insertPos == intList.end() || *insertPos != currentIndex) { - intList.insert(insertPos, currentIndex); + auto insertPos = std::lower_bound(intList.cbegin(), intList.cend(), currentIndex); + if (insertPos == intList.cend() || *insertPos != currentIndex) { + constInsert(&intList, insertPos, currentIndex); } } }