diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index d2b37bb4a0..448ba9d0e9 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -58,16 +58,17 @@ void cmDefinitions::Erase(const std::string& key) } //---------------------------------------------------------------------------- -std::set cmDefinitions::LocalKeys() const +std::vector cmDefinitions::LocalKeys() const { - std::set keys; + std::vector keys; + keys.reserve(this->Map.size()); // Consider local definitions. for(MapType::const_iterator mi = this->Map.begin(); mi != this->Map.end(); ++mi) { if (mi->second.Exists) { - keys.insert(mi->first); + keys.push_back(mi->first); } } return keys; diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index 13f885df8b..d21ec23f16 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -43,7 +43,7 @@ public: void Erase(const std::string& key); /** Get the set of all local keys. */ - std::set LocalKeys() const; + std::vector LocalKeys() const; /** Compute the closure of all defined keys with values. This flattens the scope. The result has no parent. */ diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 875442762a..9209e498db 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -89,7 +89,7 @@ public: } } - std::set LocalKeys() const + std::vector LocalKeys() const { return this->VarStack.top().LocalKeys(); } @@ -1901,8 +1901,8 @@ void cmMakefile::CheckForUnusedVariables() const { return; } - const std::set& locals = this->Internal->LocalKeys(); - std::set::const_iterator it = locals.begin(); + const std::vector& locals = this->Internal->LocalKeys(); + std::vector::const_iterator it = locals.begin(); for (; it != locals.end(); ++it) { this->CheckForUnused("out of scope", *it); @@ -4431,10 +4431,10 @@ void cmMakefile::PopScope() std::set init = this->Internal->VarInitStack.top(); std::set usage = this->Internal->VarUsageStack.top(); - const std::set& locals = this->Internal->LocalKeys(); + const std::vector& locals = this->Internal->LocalKeys(); // Remove initialization and usage information for variables in the local // scope. - std::set::const_iterator it = locals.begin(); + std::vector::const_iterator it = locals.begin(); for (; it != locals.end(); ++it) { init.erase(*it);