diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2014-02-10 05:21:34 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-03-08 18:05:35 (GMT) |
commit | 270eb96df05b93023cdd3d3a186b44b4ece1d655 (patch) | |
tree | 25d3037b5412b24242c631cccfe36e16a0fa8e1c /Source/cmDefinitions.h | |
parent | 215b1addf09359507281359cd7d478c61c01a9f2 (diff) | |
download | CMake-270eb96df05b93023cdd3d3a186b44b4ece1d655.zip CMake-270eb96df05b93023cdd3d3a186b44b4ece1d655.tar.gz CMake-270eb96df05b93023cdd3d3a186b44b4ece1d655.tar.bz2 |
strings: Remove cmStdString references
Casts from std::string -> cmStdString were high on the list of things
taking up time. Avoid such implicit casts across function calls by just
using std::string everywhere.
The comment that the symbol name is too long is no longer relevant since
modern debuggers alias the templates anyways and the size is a
non-issue since the underlying methods are generated since it's
inherited.
Diffstat (limited to 'Source/cmDefinitions.h')
-rw-r--r-- | Source/cmDefinitions.h | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index 24dad29..4c1ad0a 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -41,22 +41,25 @@ public: const char* Set(const std::string& key, const char* value); /** Get the set of all local keys. */ - std::set<cmStdString> LocalKeys() const; + std::set<std::string> LocalKeys() const; /** Compute the closure of all defined keys with values. This flattens the scope. The result has no parent. */ cmDefinitions Closure() const; /** Compute the set of all defined keys. */ - std::set<cmStdString> ClosureKeys() const; + std::set<std::string> ClosureKeys() const; private: // String with existence boolean. - struct Def: public cmStdString + struct Def: public std::string { - Def(): cmStdString(), Exists(false) {} - Def(const char* v): cmStdString(v?v:""), Exists(v?true:false) {} - Def(Def const& d): cmStdString(d), Exists(d.Exists) {} + private: + typedef std::string std_string; + public: + Def(): std_string(), Exists(false) {} + Def(const char* v): std_string(v?v:""), Exists(v?true:false) {} + Def(Def const& d): std_string(d), Exists(d.Exists) {} bool Exists; }; static Def NoDef; @@ -65,7 +68,7 @@ private: cmDefinitions* Up; // Local definitions, set or unset. - typedef std::map<cmStdString, Def> MapType; + typedef std::map<std::string, Def> MapType; MapType Map; // Internal query and update methods. @@ -75,12 +78,12 @@ private: // Implementation of Closure() method. struct ClosureTag {}; cmDefinitions(ClosureTag const&, cmDefinitions const* root); - void ClosureImpl(std::set<cmStdString>& undefined, + void ClosureImpl(std::set<std::string>& undefined, cmDefinitions const* defs); // Implementation of ClosureKeys() method. - void ClosureKeys(std::set<cmStdString>& defined, - std::set<cmStdString>& undefined) const; + void ClosureKeys(std::set<std::string>& defined, + std::set<std::string>& undefined) const; }; #endif |