From f59b12c6293505af64d86afa87a1535a603f0b01 Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Thu, 24 Dec 2015 16:38:21 +0300 Subject: MakefileGenerator: use erase and std::remove_if with QVector ... instead of using erase in a loop, with quadratic complexity. Change-Id: I4ac03ac0e893fc5dbb5e45131fcbfe82f1564bee Reviewed-by: Marc Mutz --- qmake/generators/makefile.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'qmake') diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index a54083c04d..8616e80081 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -59,6 +59,8 @@ #include #include +#include + QT_BEGIN_NAMESPACE using namespace QMakeInternal; @@ -939,12 +941,12 @@ void MakefileGenerator::filterIncludedFiles(const char *var) { ProStringList &inputs = project->values(var); - for (ProStringList::Iterator input = inputs.begin(); input != inputs.end(); ) { - if (QMakeSourceFileInfo::included((*input).toQString()) > 0) - input = inputs.erase(input); - else - ++input; - } + auto isIncluded = [this](const ProString &input) { + return QMakeSourceFileInfo::included(input.toQString()) > 0; + }; + inputs.erase(std::remove_if(inputs.begin(), inputs.end(), + isIncluded), + inputs.end()); } static QString -- cgit v1.2.3