From 1c7c35c3723abfb91f5e9a986ccd4f7e70683baf Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 15 Feb 2015 16:22:08 +0100 Subject: [PATCH] cmListCommand: Replace remove duplicates loop with algorithm. --- Source/cmListCommand.cxx | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 50adce6fe..e2ebe0ab7 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -418,24 +418,9 @@ bool cmListCommand return false; } - std::string value; - - - std::set unique; - std::vector::iterator it; - const char* sep = ""; - for ( it = varArgsExpanded.begin(); it != varArgsExpanded.end(); ++ it ) - { - if (unique.find(*it) != unique.end()) - { - continue; - } - unique.insert(*it); - value += sep; - value += it->c_str(); - sep = ";"; - } - + varArgsExpanded.erase(cmRemoveDuplicates(varArgsExpanded), + varArgsExpanded.end()); + std::string value = cmJoin(varArgsExpanded, ";"); this->Makefile->AddDefinition(listName, value.c_str()); return true;