diff --git a/lib/ctu.cpp b/lib/ctu.cpp index c2c556186..188327cdf 100644 --- a/lib/ctu.cpp +++ b/lib/ctu.cpp @@ -537,8 +537,7 @@ std::list CTU::FileInfo::getErrorPath(I if (functionCall) { if (functionCallPtr) *functionCallPtr = functionCall; - for (const ErrorLogger::ErrorMessage::FileLocation &loc : functionCall->callValuePath) - locationList.push_back(loc); + std::copy(functionCall->callValuePath.cbegin(), functionCall->callValuePath.cend(), std::back_inserter(locationList)); } ErrorLogger::ErrorMessage::FileLocation fileLoc; diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index b3167b6f7..04a9b01e2 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -296,11 +296,10 @@ static bool isUndefined(const std::string &cfg, const std::set &und static bool getConfigsElseIsFalse(const std::vector &configs_if, const std::string &userDefines) { - for (const std::string &cfg : configs_if) { - if (hasDefine(userDefines, cfg)) - return true; - } - return false; + return std::any_of(configs_if.cbegin(), configs_if.cend(), + [=](const std::string &cfg) { + return hasDefine(userDefines, cfg); + }); } static const simplecpp::Token *gotoEndIf(const simplecpp::Token *cmdtok) @@ -500,8 +499,7 @@ void Preprocessor::preprocess(std::istream &srcCodeStream, std::string &processe const simplecpp::TokenList tokens1(srcCodeStream, files, filename, &outputList); const std::set configs = getConfigs(tokens1); - for (const std::string &cfg : configs) - resultConfigurations.push_back(cfg); + std::copy(configs.cbegin(), configs.cend(), std::back_inserter(resultConfigurations)); processedFile = tokens1.stringify(); } @@ -788,13 +786,11 @@ bool Preprocessor::validateCfg(const std::string &cfg, const std::list